A Symfony2 Bundle to include Silex apps in your Symfony2 project
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Command
Resources/config
CoreListener.php
README.md
SilexBundle.php

README.md

Please note this project is now OBSOLETE and will NOT work with recent versions of Symfony and Silex.

"Un peu de Silex dans votre Symfony ?"

SilexBundle allows you to include Silex applications in your Symfony2 project.

Installation

Directly clone the Bundle into your project:

cd /path/to/your/project
git clone git://github.com/geoffrey/SilexBundle.git src/Panda/SilexBundle

Or the submodule alternative:

cd /path/to/your/project
git submodule add git://github.com/geoffrey/SilexBundle.git src/Panda/SilexBundle

Don't forget to add the bundle in your AppKernel

Caveats

Soooo, actually, you have to care about the way you write your Silex app in order to be able to include it through SilexBundle. The autoloading part may cause some trouble, so you'll have to separate it in two:

  • one part with the generic autoloading, that is Silex and all the Symfony components (which will obviously already be loaded by Symfony2). This autoloading part should be put in a separate file.

  • one part with your app's specific autoloading. For example, with Sismo I kept the Sismo namespace autoloading.

Then you have to write a file that will return your $app, just like when you want to mount it into another silex app:

<?php

// build your $app

return $app

It's that file that you'll want to set as the path of your app in the bundle's config.

Sorry if it's still a bit unclear, it's 1am here, I'll update the documentation tomorrow, but basically it all boils down to this: don't conflict autoloaders.

Configuration

see Resources/config.yml-dist

Assets

SilexBundle provides a command to publish your assets:

./app/console silex:assets:install

It works just like the default assets:install.