Moufgento is a modern MVC framework for Magento, based on the Splash MVC framework (designed for Mouf-PHP).

1.0.x-dev 2015-11-18 16:55 UTC

This package is auto-updated.

Last update: 2024-05-15 04:44:53 UTC


Why should I care?

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

Magento comes with a very heavy framework, based on Zend Framework 1. It is definitely very powerful, allowing to overload almost any part of the application. Yet, it is somewhat old and lacks the modern features we have come to love in the current MVC frameworks, like dependency injection, annotations support, few or no XML configuration files... For these reasons, if you find yourself with a need to do a massive custom application inside Magento, you might want to use something else than Magento default framework.

Moufgento is at the same time a module for Magento that adds PSR-7 compatible middleware support AND an integration of Splash, the default MVC framework that comes with Mouf and that is provided as a middleware.

Moufgento offers the following features:

  • The ability to plug any zend/stratigility middleware (i.e. PSR-7 Middleware) in Magento
  • A default router (Splash) with
    • controllers, declared through a nice graphical DI container
    • use of annotations in your controllers (for instance: @URL to declare a new route, @Logged to restrict access to logged users, etc...)
    • support for any kind of views supported in Splash MVC (this includes plain PHP files, Twig templates, etc...)
    • a nice web-based UI to scafold your controllers and views
    • integration of your views inside the Magento theme
    • (very) easy Ajax support
    • integration of Mouf's authentication system into Magento
    • integration of Mouf's web library (JS/CSS) system into Magento

Moufgento has been tested with Magento CE 1.9.

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 Magento (or the opposite), or any other third party system that Splash can be plugged into (i.e. Drupal, Wordpress, Joomla...)


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

  1. Start by installing Magento as you would normally do.
  2. Install the Mouf PHP framework in the same directory as Magento This means you should have the composer.json file of Composer in the same directory as the index.php of Magento.
  3. Modify composer.json and add the moufgento module. Your composer.json should contain at least these lines:
    "repositories": [
        "type": "composer",
        "url": ""
        "type": "vcs",
        "url": ""
    "autoload" : {
        "psr-0" : {
            "MyApp" : "src/"
    "require" : {
        "magento-hackathon/magento-composer-installer": "*",
        "mouf/mouf" : "~2.0",
        "mouf/integration.magento.moufgento" : "~1.0",
    "minimum-stability" : "dev",
    "prefer-stable": true

Do not forget to customize your vendor name (the MyApp part of the autoloader section). 4. Create the empty src/ directory at the root of your project. 5. Run the install process in Mouf: connect to Mouf UI and run the install process for all the packages (including Moufgento install process of course) 6. You have now to patch the Magento Autoloader because there is some weird issue with the class_exists function . First, copy app/code/core/Varien/Autoload.php into app/code/local/Varien/Autoload.php Then, in the autoload method, replace :

return include $classFile;


return @include $classFile;

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: