1

We have a 5 years old system built by Drupal 5. It is not a small system (about 50K lines of code), and most of the functionality has nothing to do with 'content management'.

For this reason, we're thinking about integrating Symfony2 to our current system. The ideal is to keep using the current code for current functionality while developing new features with Symfony2. Slowly we'll move more and more pieces of code from Drupal to Symfony.

My question is how do you suggest implementing this? I though about the following approaches:

  1. Create a module in Drupal. This module will contain the Symfony files and will load the class loader of Symfony. Someone has done this before? are there some critical things I should be aware of?

  2. Create a separate installation of Symfony and hopefully create a different vhost record which point to certain pages in the website. As far as I know I can configure vhost to be a sub-host of my current host (e.g. mysymfony.mydrupal.com). But I can't configure it to point to a specific path in the same domain (mydrupal.com/mysymfony.php). is this true? In this approach the performance would be better for those pages that use Symfony, since it won't need the Drupal bootstrap.

  3. Any other suggestions?

Thanks!

2 Answers 2

2

Be aware that you'll likely have to upgrade your PHP version on the machine running Drupal if you'd like to run Symfony2 on the same machine (anything under 5.3.8 and the configurator will object). You may also want to hold out for a bit if you want to stick with Drupal - Drupal 8 is integrating Symfony2 components. Also, there exists (in beta form anyhow), a content management framework for Symfony2.

Regarding vhosts, you are correct - you point a vhost to a directory, not a file. You could however create a rewrite rule to redirect to a specific page, if you wanted (check out the .htaccess file included in the web/ directory in a Symfony distribution - by default it redirects requests to app.php).

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you. Actually we've already updated our PHP to 5.3. Drupal 8 could be a good option, but it's going to take a while for a stable version of the core and the basic modules. Regarding the vhost, I don't have to point to a specific file, it'll be OK if I can do it for a directory. For example: 'www.exmpale.com' => /var/www/drupal. 'www.example.com/mysymfony' => /var/www/symfony. Is this possible?
As far as I know you can't do that with virtual hosts - if "www.example.com" is a virtual host, then "example.com/mysymfony" is a resource within that virtual host root. But you could create "mysymfony.example.com" as a virtual host to point to /var/www/symfony (or more likely, /var/www/symfony/web). But that's httpd related rather than drupal or symfony. Why would you want to do that, anyway?
Because I want all the pages to go to Drupal, but some of them to go to Symfony2. I can get the same results if I'm changing the index.php of drupal or symfony and redirect from there, but I prefer to do from the webserver level.
1

Because I'm new here I can't have more than two links in a post. I was also going to say:

I would start rewriting core functionality (users, permissions, etc) if none of the existing bundles meet your needs. As well as searching github, you could try knpbundles.com to find bundles that solve similar problems.

3 Comments

For roles and permission I think I have to stick with Drupal tables, since the users/roles/permissions are already configured there. As a result I won't be able to use Symfony2 bundle: 'FOSUserBundle'.
Perhaps not, but see e.g. FOSFacebookBundle or FOSTwitterBundle - they authenticate users against other resources. I think you may be interested in symfony.com/doc/2.0/cookbook/security/…
If you're new to Symfony2, I highly recommend spending a little bit of money and go buy and watch the screencasts at knpuniversity.com - they'll get you up and running quickly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.