# flake **Repository Path**: colisys/flake ## Basic Information - **Project Name**: flake - **Description**: Flake (Lekoi Lite Web Application Framework) - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-12 - **Last Updated**: 2025-10-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ๐ŸงŠ Flake

Flake Framework Logo

A minimal PHP microframework inspired by Express.js โ€” simple, fast, and easy to extend. ## ๐Ÿš€ Installation Create a new project using Composer: ```bash composer create-project iescarro/flake myapp ``` Then start the development server: ```bash cd myapp composer start ``` Visit: http://localhost:8000 ## ๐Ÿ“ Directory Structure ``` myapp/ โ”œโ”€โ”€ composer.json โ”œโ”€โ”€ public/ โ”‚ โ””โ”€โ”€ index.php โ””โ”€โ”€ src/ โ”œโ”€โ”€ App.php โ”œโ”€โ”€ Router.php โ”œโ”€โ”€ Request.php โ””โ”€โ”€ Response.php ``` ## ๐Ÿงฉ Example Routes (public/index.php) ```php status(200)->send("

Flake v1.0.0

Welcome to your minimal PHP microframework!

"); }); Router::get('/hello', function (Request $req, Response $res) { $name = $req->get('name', 'World'); $res->send("Hello, {$name}!"); }); Router::get('/json', function (Request $req, Response $res) { $res->json([ 'message' => 'Welcome to Flake!', 'version' => '0.0.1' ]); }); Router::fallback(function (Request $req, Response $res) { $res->status(404)->send('

404 Not Found

That route does not exist.

'); }); Middleware::use(function (Request $req, Response $res, $next) { error_log("Request: " . $req->method() . " " . $req->uri()); return $next($req, $res); }); Middleware::use(function (Request $req, Response $res, $next) { if ($req->method() === 'OPTIONS') { $res->header('Access-Control-Allow-Origin', '*'); $res->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); $res->header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); return $res->status(204)->send(''); } return $next($req, $res); }); App::run(); ``` ## ๐Ÿงฑ Middleware Example You can chain multiple middleware just like in Express: ```php Middleware::use(function ($req, $res, $next) { error_log('Before route'); $next($req, $res); error_log('After route'); }); ``` ## ๐Ÿงช Development Run tests or the server with Composer: ``` composer start ``` ## ๐Ÿ“œ License Licensed under the MIT License. Copyright ยฉ 2025 FlakePHP