Yay! I managed to boot both Drupal 8 and Symfony Framework bundle in one Symfony setup. If you look at the screenshot closely, you will see Symfony Profile toolbar inside a Drupal setup.
The original idea is from Theodo, you use a bundle to bridge the between Drupal and Symfony, using EventListener to intercept the request and route to Drupal core if Symfony does not handle it.
So to run Drupal inside Symfony, first you need to start a new symfony application. Just follow the tutorial on the website.
Then you need to adjust the composer.json to include Drupal, and explicitly state the dependencies. At this time, you will have to use Symfony 2.4 or Composer will refuses to checkout due to dependencies conflict. Here is my composer.json. Make sure to run composer update after that, it will takes a while to download all the dependencies.
Once all the dependencies are installed. Checkout or Download TheodoDrupal8Bundle to src. I have forked the origin repository and adjust some change to support core/install.php request. Since Drupal 8 also coming with it own vendor, you will need to modify vendor/drupal/drupal/core/vendor/composer/autoload_files.php and comment all items in the return part. Your autoload_files.php should look like below:
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname(dirname($vendorDir));
//$vendorDir . '/guzzlehttp/streams/src/functions.php',
//$vendorDir . '/kriswallsmith/assetic/src/functions.php',
//$vendorDir . '/guzzlehttp/guzzle/src/functions.php',
//$baseDir . '/core/lib/Drupal.php',
Then execute the following command in project root to expose Drupal’s resource to public folder.
ln -s ../vendor/drupal/drupal/modules
ln -s ../vendor/drupal/drupal/sites
ln -s ../vendor/drupal/drupal/profiles
ln -s ../vendor/drupal/drupal/themes
ln -s ../../vendor/drupal/drupal/core/assets
ln -s ../../vendor/drupal/drupal/core/modules
ln -s ../../vendor/drupal/drupal/core/misc
ln -s ../../vendor/drupal/drupal/core/themes
And now when you run your symfony application, you should see the Drupal installation page 😀
There are many interesting things to do, like bridging between Drupal entity and Symfony entity, synchronizing database configuration in 2 systems, integrating Symfony entities in views. But this is a good start already.