Routes & controllers
Map GET and POST routes to controller actions. Named numeric and slug parameters connect URLs to your code.
Routing guide ↗GluônFW · MICROFRAMEWORK
A minimal PHP framework for small websites. Routing, controllers and views, with no external dependencies in the core.
PHP 8.1+ · MIT license · By 4ASuite
return [
'GET' => [
'/' => [HomeController::class, 'index'],
'/users/(:num:id)' => [
UserController::class, 'show'
],
],
];public function index(): Response
{
return $this->view('home', [
'title' => 'Your next project',
]);
}A FOCUSED FOUNDATION
Map GET and POST routes to controller actions. Named numeric and slug parameters connect URLs to your code.
Routing guide ↗Return HTML views, JSON or redirects. Compose PHP templates with layouts and escape output using e().
Session handling, CSRF helpers and response headers are included. Add token verification to your POST actions.
CSRF guide ↗QUICK START
composer create-project 4asuite/nano-php myprojectRun the command above, then open the new project folder.
cd myprojectPoint your web server at public/ and open the welcome page.
Edit App/Config/routes.php and add your controller and view.
App/
├── Config/routes.php
├── Controllers/
├── Core/
├── Models/
├── views/
│ ├── layouts/
│ └── partials/
└── bootstrap.php
public/
├── index.php
└── .htaccess
composer.jsonBEFORE YOU START
| PHP | 8.1 or later |
|---|---|
| Web server | Apache with mod_rewrite, or an equivalent front-controller setup |
| Installation | Composer |
| Core dependencies | No external packages |
FREE & OPEN SOURCE
MIT licensed. Read the source and documentation on GitHub.
Read the license ↗