outlandish / routemaster-bundle
Installs: 3 745
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 9
Forks: 1
Open Issues: 0
Requires
- symfony/framework-bundle: ~2.3
This package is auto-updated.
Last update: 2022-02-15 15:15:58 UTC
README
Use WordPress as the CMS backend for your Symfony 2 application.
Easy install
Download Symfony WordPress Edition which comes set up to use this bundle, OowpBundle and a few useful WordPress plugins.
Manual install
1. Add to composer.json
"require": {
"outlandish/routemaster-bundle": "dev-master",
},
2. Add WordPress installer script
Until a way is found to allow Composer to install and manage WordPress, this script can be used to ensure WordPress is present:
"scripts": {
"post-install-cmd": [
"Outlandish\\RoutemasterBundle\\Composer\\WordPressInstaller::install"
],
"post-update-cmd": [
"Outlandish\\RoutemasterBundle\\Composer\\WordPressInstaller::install"
]
},
3. Run composer update
4. Add to AppKernel.php
public function registerBundles()
{
$bundles = array(
//...
new Outlandish\RoutemasterBundle\OutlandishRoutemasterBundle(),
);
return $bundles;
}
5. Load WordPress in your front controller
<?php
use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\HttpFoundation\Request;
//load WordPress
require 'wp-load.php';
require_once __DIR__ . '/../app/autoload.php';
require_once __DIR__ . '/../app/AppKernel.php';
//...
Usage notes
Routing
Use Countroller and Routing
components as you would in a normal Symfony application. The front controller web/index.php
loads WordPress before
booting Symfony which means standard WordPress functions and classes such as WP_Query
are available in your Symfony controllers.
Database
It is recommended (for performance and simplicity) to use WordPress's $wpdb
global if you require direct database
access but you could also use Doctrine or another ORM.
Caching
Caching is best handled by WordPress. Since WP is loaded first, a cache hit means that Symfony is not loaded at all.
Plugins
Most WordPress plugins will continue to work, especially those that mainly affect the admin side. If in doubt, try it and see. It is recommended to use Composer and WPackagist for plugin management.
Themes
Normal WordPress themes will not work here. But you knew that, right?