New in Mouf 2: improved validators

Mouf has had self-check validators for quite a long time now. And for quite a long time, it was possible to extend those validators in your packages.

It was possible, but not complely easy, as you add to write several conf files to set them up.

This time is over! Now, you can write your own validators in a breeze, just by extending one interface.

Check out the documentation!

Here is a sample:

class SplashHtaccessValidator implements MoufStaticValidatorInterface {
     * Runs the validation of the class.
     * Returns a MoufValidatorResult explaining the result.
     * @return MoufValidatorResult
    public static function validateClass() {
        if (file_exists(ROOT_PATH.".htaccess")) {
            return new MoufValidatorResult(MoufValidatorResult::WARN, "Unable to find .htaccess file.");
        } else {
            return new MoufValidatorResult(MoufValidatorResult::SUCCESS, ".htaccess file found.");

A simple method that returns a "MoufValidatorResult", and each time you start Mouf, your validator will be executed. There are 2 kinds of validators: "class" validators (one validation per class) and "instance" validators (one validation per instance defined in Mouf)

And as a bonus, the Mouf self-check status screen has been revamped:

Read the doc and enjoy!

Tags :