Minimal PHP framework.
No magic, no bloat.

Routing, controllers, views, and a few security essentials. Built for small websites that need structure without complexity.

composer create-project 4asuite/nano-php ⎘ copy
No magic

No hidden conventions, no auto-wiring. Every line of code is exactly where you put it.

No dependencies

Zero external packages in the core. PHP 8.1+ and a web server — nothing else required.

Just your code

The framework provides structure. You write the logic. No opinions on your architecture.

What's inside

The core

RouterGET/POST with named parameters. Pattern matching via (:num:id) and (:any:slug).
ControllerBase class with view(), json(), and redirect() helpers.
RequestWraps input with get(), post(), input(), method().
ResponseFluent API for HTML, JSON, redirect, and security headers.
SessionSecure session with httponly, samesite=Lax, strict mode.
CSRF64-char hex token, stored in session, rotated on each verification.
View + LayoutPHP templates with layout system and e() escape helper.
EnvLoaderLoads .env as PHP constants. Dot-notation: DB.HOSTDB['HOST'].

Get started

Quick start

1Install
composer create-project 4asuite/nano-php myproject
cd myproject
php -S localhost:8000 -t public
2Define a route
// App/Config/routes.php
return [
  'GET' => [
    '/'      => [HomeController::class, 'index'],
    '/about' => [HomeController::class, 'about'],
  ],
];
3Create a controller
class HomeController extends Controller
{
  public function index(): Response
  {
    return $this->view('home', [
      'title' => 'Home'
    ]);
  }
}
4Create a view
<!-- App/views/home.php -->
<h1><?= e($title) ?></h1>
<p>Welcome to Nano PHP.</p>

Compatibility

Requirements

  • PHP ^8.1 No extensions beyond standard
  • Apache / Nginx With mod_rewrite or front-controller setup
  • Composer For installation and PSR-4 autoloading
  • Zero dependencies No external packages in the core