Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

outlandishideas/RoutemasterBundle

Repository files navigation

Routemaster Bundle for WordPress

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?

About

Use WordPress as the CMS backend for your Symfony application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages