A clean starting point for building applications with NixPHP — the minimal and flexible PHP microframework.
"As simple as possible, as flexible as necessary."
composer create-project nixphp/app my-appAlternatively, clone the repo manually:
git clone https://github.com/nixphp/app my-app
cd my-app
composer installMake sure your webserver points to the /public directory as document root.
- PHP 8.3+
- Composer
- A webserver (e.g. Apache, nginx, or PHP’s built-in server)
/app
/Controllers
/Models
/views
config.php
routes.php
/public
index.php
bootstrap.php
composer.json
app/contains your application logicpublic/is the webrootbootstrap.phpinitializes the appconfig.phpholds your app configurationroutes.phpcontains all the routes
- Define your first route in
app/routes.php:
route()->add('GET', '/', [App\Controllers\HomeController::class, 'index']);- Create a controller in
app/controllers/HomeController.php:
namespace App\Controllers;
use function NixPHP\render;
class HomeController
{
public function index()
{
return render('home', ['name' => 'World']);
}
}- Create a view in
app/views/home.phtml:
<?php use function NixPHP\s; ?>
<h1>Hello, <?= s($name) ?>!</h1>This app skeleton is based on the NixPHP microframework.
It’s designed to give you a clean starting point — nothing more, nothing less.
To learn more about NixPHP and its philosophy, check out the main documentation.
MIT License. See LICENSE for details.
Ready to build something awesome?
Start hacking with NixPHP. 🚀