This is the Ekino Wordpress plugin to interact with Symfony.
- Put the following lines at the beginning of your
wp-config.php
file, according to your project configuration:
define('WP_SYMFONY_PATH', __DIR__.'/symfony/');
define('WP_SYMFONY_ENVIRONMENT', 'dev');
define('WP_SYMFONY_DEBUG', true);
- Enable the "Ekino Wordpress Symfony" plugin in WordPress Extensions list.
You can retrieve all Symfony services registered in the dependency injection container with the following method:
$service = \symfony_service('my.symfony.service.identifier');
This plugin allows Wordpress to dispatch some hooks on the Symfony EventDispatcher component.
An example with the three following hooks has been added:
- wp_login: authenticate the user in Symfony application on Wordpress login
- wp_logout: logout user from Symfony when user logout of Wordpress
- auth_cookie_valid: authenticate the user when the auth cookie is valid