This bundle wraps your old Symfony 1.4 project in Symfony2
Pull request Compare This branch is 1 commit ahead, 14 commits behind Ingewikkeld:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What is it?

symfony14-wrapper-bundle is a simple Symfony2 bundle (based on IngewikkeldWrapperBundle) to wrap an old legacy Symfony 1.4 application. This allows you to gradually refactor your old Symfony 1.4 code with spankin' new Symfony2 code.

The bundle works with a fallback route: all routes that are not caught by your Symfony2 code are routed into the bundle, which in turn bootstraps your Symfony 1.4 project.

Note: While this bundle can be very useful, it is not recommended to use it for too long. You are running two different frameworks for each request that goes through this bundle, meaning there's two frameworks adding an overhead to each request. If you have the possibility, look into caching the output of your legacy code in Symfony2.


Installation is done in just a couple of steps:

  1. Download the bundle
  2. Configure the autoloader
  3. Enable the bundle
  4. Configure your legacy project
  5. Copy your assets to the document root
  6. Configure your routing
  7. Refactor your project

1. Download the bundle

Make sure the bundle is being placed in vendor/bundles/aredridel/IngewikkeldWrapperBundle. You can do this by using the vendors script, using submodules or downloading the zip file.

vendors script

Open the deps file in your Symfony2 project, and add the following:


Now, install the vendors by running:

$ bin/vendors install


If you are using Git, you can also use submodules to install the bundle into your project. Execute the following commands in your project root:

$ git submodule add git:// vendor/bundles/Ingewikkeld/WrapperBundle
$ git submodule update --init

zip file

Of course, you can just download the zip file from Github. Unzip the file and copy the contents of the zip-file into the vendor/bundles/Ingewikkeld/WrapperBundle directory of your Symfony2 project.

2. Configure the autoloader

Before the Ingewikkeld namespace can be loaded, we need to set up the autoloader to actually load the namespace. For this to work, you need to edit the app/autoload.php file. In the $loader->registerNamespaces() call, you need to add the Ingewikkeld namespace, like this:

	// ...
    'Ingewikkeld'      => __DIR__.'/../vendor/bundles',

3. Enable the bundle

Enable the bundle in the AppKernel (app/AppKernel.php). In the registerBundles() method, add the WrapperBundle to the $bundles array:

   $bundles = array(
		// ...
        new Ingewikkeld\WrapperBundle\IngewikkeldWrapperBundle(),

4. Configure your legacy project

Put your legacy project in your app/ directory. For my first project, I put my whole project into the app/legacy/ directory. Now, add some configuration values to app/config/config.yml to set up the WrapperBundle to serve pages from your legacy Symfony 1.4 project:

    wrapper_legacypath: legacy # directory inside app/ where your project is located
    wrapper_app: frontend # app to load
    wrapper_env: prod #environment to load
    wrapper_debug: false #whether debug is on or not

5. Copy your assets to the document root

All files that need to be available in the document root need to be copied there from your legacy project. Right now, those are not yet automatically loaded (see "Known issues"), so they have to be copied over to the web/ directory of your Symfony2 project. Usually, you copy over the images/, css/, js/ and uploads/ directories.

6. Configure your routing

At the bottom of your app/config/routing.yml file, add the following:

Symfony14WrapperBundle: resource: "@Symfony14WrapperBundle/Controller/" type: annotation prefix: /

This will ensure the wrapper route will catch all requests that are not caught by any other route.

7. Refactor your project

Now, start refactoring and porting your legacy project into Symfony2 code.

Current state of the project

The current state of the project is: Work In Progress

Known issues / TODO

  1. Assets are not automatically loaded but have to be copied over to the Symfony2 documentroot
  2. There is no compatibility with Symfony 1.0.
  3. It is currently only possible to wrap one legacy app.
  4. No session sharing at the moment