mouf/integration.wordpress.moufpress

A MVC framework for Wordpress based on Mouf and compatible with Splash MVC

3.0.x-dev 2015-11-18 16:03 UTC

This package is auto-updated.

Last update: 2024-10-15 04:50:41 UTC


README

Logo

Why should I care?

Moufpress is a MVC framework for Wordpress. Actually, it is a bridge between Wordpress and the Splash MVC framework used by Mouf-PHP (a dependency injection based framework).

MoufPress offers the following features:

Another interesting feature is that your code is 100% compatible with Splash MVC. This means that:

  • You can write a controller in Splash MVC and deploy it later in Wordpress (or the opposite)
  • Since there is also a Drupal module for Splash (Druplash), you can actually write a controller in Wordpress and deploy it in Drupal (or the other way around). Yes, you read it correctly, you can develop an application that will run on both Wordpress and Drupal (!) Haha! I see you're interested. Let's get started!

Installation

You will first need to install Wordpress and Mouf side by side.

  1. Start by installing Wordpress as you would normally do.

  2. Install the WP-Router plugin.
    Note: even if the plugin page stats this plugin works up to version 3.4 of Wordpress, we have tested with Wordpress 3.8.1 and 4.3.1 and it works great.

  3. Install the Mouf PHP framework in the same directory as Wordpress This means you should have the composer.json file of Composer in the same directory as the wp-config.php of Wordpress.

  4. Modify composer.json and add the moufpress module. Your composer.json should contain at least these lines:

     {
     	"autoload" : {
     		"psr-4" : {
     			"MyApp\\" : "src/MyApp"
     		}
     	},
     	"require" : {
     		"mouf/mouf" : "~2.0",
     		"mouf/integration.wordpress.moufpress" : "~3.0"
     	},
     	"minimum-stability" : "dev",
     	"prefer-stable": true
     }
    

    Do not forget to customize your vendor name (the MyApp part of the autoloader section).

  5. Create the empty src/ directory at the root of your project.

  6. Run the install process in Mouf: connect to Mouf UI and run the install process for all the packages (including Moufpress install process of course)

  7. If it has not been done already, activate the WP Router module, as well as URL rewriting in settings >> permalinks menu (the only option that CANNOT be set is the default one : http://localhost/wordtest/?p=123).

  8. When you downloaded Moufpress, Composer automatically copied a Moufpress plugin in the wp-content/plugins directory of Wordpress. You need to install this plugin. Connect to your Wordpress admin, select the Plugins > Installed plugins menu, and click on the "Activate" button for the "Moufpress" plugin.

Getting started

In the next section, we will learn how to create a controller and a view.

Or if you already know Splash, you can directly jump to another part of this documentation: