Welcome to Monti!

A modular PHP framework, built for speed and simplicity

Get started

Features

MVC

The well-known Model-View-Controller pattern, integrated and ready to use: extend a base Controller and Model, and build your views with a native, extensible PHP template engine — no boilerplate to write.
Model class
MyModel.php
namespace App\Modules\ModuleName;

class MyModel extends \App\System\MVC\Model {
    //code here
}
Controller class
MyController.php
namespace App\Modules\ModuleName;

class MyController extends \App\System\MVC\Controller {
    public function welcome() {
        return view("welcome", [
            "message" => "Hello World!"
        ]);
    }
}
View file
welcome.php
<!-- prints "Hello World!" -->
<?= $message ?>

Modules

Write the code once and reuse it as many times as you want. The primary way to extend Monti's capabilities and bring your ideas to life. Modules are the pieces that make up your next project.
Basic structure of a module:
ModuleName
composer.json
src
Bootstrap.php
MyController.php
MyModel.php
routes.php
views
Package manifest
composer.json
{
    "name": "your-vendor/modulename",
    "type": "library",
    "description": "A short description of what this module does",
    "autoload": {
        "psr-4": {
            "Your\\Namespace\\ModuleName\\": "src/"
        }
    },
    "extra": {
        "monti-framework": {
            "providers": [
                "Your\\Namespace\\ModuleName\\Bootstrap"
            ]
        }
    }
}
Bootstrap class
Bootstrap.php
namespace Your\Namespace\ModuleName;

class Bootstrap {
    public function init() {
        (new MyController())->load_routes();
        \App\System\MVC\View\View::addModuleSourcePath(__DIR__ . "/views", "ModuleName");
        \App\System\Project::pushModule("ModuleName", MyController::class);
    }
}

Routing

A fast, expressive router, with named routes, route groups, namespaces and automatic URL generation — declare a route in one line.
routes.php
router()->get("/", function() {
    return view("home");
});

//Grouped routes
router()->group("users", function($group) {
    // /users/login
    $group->post("/login", "MyController@myLoginMethod");
    //or $group->post("/login", [MyController::class, "myLoginMethod"]);
});

router()->get("/another-route", ...);

Middlewares

Inspect, filter or short-circuit HTTP requests before they reach your code, with a standard, PSR-15 compliant middleware pipeline.
IsLogged.php
class IsLogged {
    public function process($request, $handler) {
        if(!\Auth::isLogged()) {
            return redirect(url("users.login"));
        }
        return $handler->handle($request);
    }
}

router()->get("/dashboard", "Dashboard@index")
    ->middleware(IsLogged::class);

Monti values

Monti is designed and built according to 4 fundamental principles
Simplicity
Sometimes the first approach with a new tool can seem difficult, Monti aims to have a low learning curve, in order to use the framework in the shortest possible time and be able to immediately dedicate to the realization of your projects.
Scalability
Build projects of any size: one page websites, multi page websites, blogs, CRM, eCommerce and so on. The only limit is your imagination.
Speed
Watch your ideas grow quickly before your eyes. Speed of installation, speed of startup, speed of learning and using, speed of customization, speed in everything.
Customization
Every idea and every project is unique, as is their realization, and for this reason there is sometimes the need to modify the software code to customize some processes, Monti tries to make this operation simple too.
Get Monti now and bring your next project to life!
Get started