Finally! Mouf 2 is getting a stable release!

Framework philosophy (or what makes Mouf different)

Mouf was born in 2009 from the vision that dependency injection was at the same time over-complicated and also under-used. Today, most frameworks are based on dependency injection containers (DIC). The role of these containers is to create instances of objects for the developer.

But these containers are often hard to configure (complex XML/YAML files) or limited (auto-binding). Therefore, they are limited to configuring "services" (i.e. a logger, or a database connection). But technically, nothing should stop a developer from using a container to store other objects, (menu item / a form with its fields / a datagrid with its columns...) Its just that current frameworks are really poor at providing an easy way to do this. As a result, they usually restrict the dependency injection container usage to a few dozens instances.

We believe you should store much more in the container. We believe you should not be afraid of it because it should be easy to use! This is why Mouf has a built-in extensible web-based user interface. There is no CLI in Mouf. Everything is done graphically.

After 6 years of development, we are delighted to announce that Mouf 2 is getting its first stable release. Creating and configuring instances is about drag'n'dropping classes together. For instance, you can easily build a menu by simply drag'n'dropping menu items togethers:

Of course, this is only a sample use case, you can bind any kind of objects together. The important part is that we are no more limited by the tedious dependency injection configuration files. Here at TheCodingMachine, we have projects that reach almost 1000 declared instances, used to configure everything from services, to controllers, to SQL requests or HTML widgets.

When you get used to that philosophy, you start to think about your application in a different way. Instead of spending most of your time thinking how you can use a set of components together, you will start thinking how you can develop reusable classes and bind them using Mouf's user interface. By following this design philosophy, you can stop worrying about the plumbing (that's Mouf's job). Instead, you will start focusing on writing cleaner, more reusable code because it is such a great pleasure to drag'n'drop an instance of a class you just created into your application :)

About the 2.0 milestone

Mouf 2.0 is already used in several dozens of projects that have already been deployed in production, some for almost 2 years, so it was definitely about time to tag this release.

Mouf is both a dependency injection framework with a graphical user interface and full-stack framework. Today, it's the core of Mouf (the dependency injection framework) that gets upgraded to 2.0. If you are looking at the full-stack framework, you may want to start by having a look at the packages chart.

Mouf 2 in the PHP ecosystem

Furthermore, Mouf 2 is now a framework that is turned towards the other frameworks and the community at large. Here is a short list of other softwares you can easily integrate with Mouf:

  • First of all, Mouf is one of the very first packages to be compatible with ContainerInterop. This makes it possible to use Mouf as the DI container of any framework having ContainerInterop support!
  • It is also one of the first projects to be compatible with the "delegate lookup feature" of ContainerInterop (that's normal, the Mouf team pushed forward this feature). This means you can use Mouf DIC alongside other compatible DIC like PHP-DI, Pimple-interop or Symfony 2
  • Mouf 2 also comes with bindings into popular CMSes like Drupal, Wordpress or Joomla => You write your controller once, deploy it in any CMS!
  • Splash (Mouf's MVC framework) is using Twig as its default templating engine
  • There are also bindings with Doctrine DBAL and Doctrine ORM
  • Splash (Mouf's MVC framework) is now compatible with StackPHP middlewares

Where are we going now?

If reaching a stable v2.0 is an achievement, it also marks the beginning of a new important phase of development. In the coming monthes, you can expect:

  • Ever increased support for interoperability with other frameworks. We are indeed contemplating the possiblity to propose "ContainerInterop" as a PSR. If "ContainerInterop" is widely adopted, this would make it possible for Mouf to be integrated into a wide range of compatible projects.
  • Loosely coupling the DIC and the user interface: Mouf's core is really split into 2 parts: the dependency injection framework, and the user interface. We plan to break those into 2 different packages.
  • Eventually the graphical user interface might be extended to support dependency injection in other frameworks
  • Finally, we will continue working on the full-stack framework. In the coming months, we will work on more "out-of-the-box" components, like a complete end-to-end users authentication and management system (with database persistence layer and users administration).

New features in details

For those of you who missed the last 3 years of development, here is a brief summary of the major features that were added:

  • A brand new user interface. Graphical dependency injection is going a step further:
  • The DI container has been going a complete rewrite with added support for:
    • Constructor injection (that was really needed :) )
    • Support for Pimple-like callback injection, into instances, or into properties
  • Complete composer support (the Mouf 1 packaging system was deprecated in favor of Composer)
    • Mouf now has 140+ dedicated packages covering all the features you would expect to see in a full-stack PHP framework
  • Improved validator support so that you can easily pinpoint misconfigurations in your project (if you are a package developer, you can also easily add additional validators to your project)
  • Finally, improved everything! There is just not a single part of Mouf that was not tremendously improved while going V2, so you have absolutely no valid reason for not trying it right now!