Mix WordPress and Symfony together

Actualité ekino -

A Symfony bundle and a Wordpress plugin to mix your blog with a framework.

Article paru le :
Mix Wordpress and Symfony together
Article paru le :

After our recent post “Drupal and Symfony2. Don’t wait for Drupal8” which allows you to mix Drupal and Symfony, we released today some other tools to mix Symfony and WordPress, the most used blog platform.

Sometimes, you have to add custom logic and WordPress is not really the best tool to do those things so the best way is to do this with a framework and guess what, Symfony is here.

You can now work on Symfony and WordPress together with two components: a Symfony bundle (that can work alone) and an additional WordPress plugin that can be installed if you need to go further.

Moreover, with the new release of WordPress 3.8 “Parker” which is now responsive and support all devices, we now have another good reason to give WordPress some good!

sf-wp

Symfony part: EkinoWordpressBundle

This is the Symfony bundle to deal with your WordPress blog. It will give to Symfony the ability to:

  • Use custom Symfony services into WordPress,
  • Use Symfony to manipulate WordPress database,
  • Create custom Symfony routes out of WordPress,
  • When authenticated on WordPress, authenticated on Symfony too with correct user roles. (requires ekino-wordpress-symfony WordPress plugin),
  • Catch WordPress hooks to be dispatched by Symfony EventDispatcher (requires ekino-wordpress-symfony WordPress plugin).

This bundle (and the installation manual) is available on Github here: https://github.com/ekino/EkinoWordpressBundle

WordPress part: ekino-wordpress-symfony plugin

This is the WordPress plugin that adds functionalities like catch WordPress hooks to be send to Symfony as events via the EventDispatcher component.

WordPress plugin (and the installation manual) is available on Github here: https://github.com/ekino/ekino-wordpress-symfony

Feel free to contribute!

Source code are available on Ekino’s Github account, please feel free to create issues, send us pull requests or help us to improve them in all other ways you can imagine. Also, do not hesitate to contact us if you want more information about them.

Commentaires (11)
  1. Federico Gabriel Raffo Molina

    Hello:

    I tried your code, pear and almost everything is excelemente well. Only when I try to load the main page of my project jumps me an error:
    _________________________________________________________________________________________________________________________
    Catchable fatal error: Argument 1 passed to Symfony\HttpKernel\Jerbek::terminate() must be an instance of Symfony\Component\HttpFoundation\Request, string given, called in C:\wamp\www\symfony\web\app.php on line 25 and defined in c:\wanp\www\symfony\app\bootstrap.php.cache on line 2194
    _________________________________________________________________________________________________________________________
    If you were so kind and whether you’ve fixed, your Might you help me fix it. From already thank you very much.

  2. Federico Gabriel Raffo Molina

    It`s Ok.
    Error:
    Catchable fatal error: Argument 1 passed to Symfony\Component\HttpKernel\Kernel::terminate() must be an instance of Symfony\Component\HttpFoundation\Request, string given, called in … /symfony/web/app.php on line 29 and defined in … /app/bootstrap.php.cache

    Solution:
    Rename global variable names $request by $sfRequest in the app.php

    Thank you very much alike

  3. Vincent Composieux

    Vincent Composieux

    Yes, as specified in the README file 😉

    Does not hesitate to open Github issues if you have some other issues with this bundle.

    Thank you!

  4. pingdavid

    EkinoWordpressBundle works well. However, the wordpress plugin (ekino-wordpress-symfony) does not seem to work with wordpress 3.9.1. See https://github.com/ekino/ekino-wordpress-symfony/issues/3

    1. Vincent Composieux

      Vincent Composieux

      Hi David,

      Indeed, we have to work on this issue to fix the plugin with the latest WordPress version, I will try to fix it during the week-end.

      If you don’t need cookie authentication hook, you can comment it in the plugin code, this will avoid this issue while waiting for the fix.

      Thank you for waiting

  5. john

    Bonjour,
    je suis entrain d’utiliser EkinoWordpressBundle et son plugin dans un projet symfony intégré a wordpress afin de manipuiler la base de données de wordpress depuis symfony.Mais le problème je n’arrive pas l’affichage avec le toolbar de symfony.J’ai l’affichage de wordpress avec cette erreur
    RuntimeException: Failed to start the session because headers have already been sent by “C:\wamp\www\wordpress\wp-includes\post-template.php” at line 51.

    1. Thomas VIAL

      Thomas VIAL

      Bonjour John, le support de ce plugin est fait via Github.

      A bientôt,

  6. Symfony + WordPress | A Coder's Life

  7. Elvis

    Silly question,

    How do this SF2 bundle connects to the wordpress database from the Symfony side? There is not required a database connection on a parameters.yml file? Maybe it souds like a dummy question, but came curious how is the connection to the wordpress database done to manage posts and everything else, Because I didn’t see any explanation on the readme at github https://github.com/ekino/EkinoWordpressBundle

    1. Thomas Rabaix

      Thomas Rabaix

      Hello Elvis,

      There is a set of Manager classes which link wordpress models (from a Symfony point of view with Doctrine). So the connection used is the default configured from doctrine. This is quite classic structure for people coming from Symfony, we need to improve the documentation for people with only WordPress knowledges.

  8. hosting information

    Hi guys,

    i just tried out your work, it’s awesome ! would you be kind enough to post the nginx equivalent of the rewriting rules on the github page ?

Laisser un commentaire