Versatile PHP micro-framework for build APIs and websites quickly
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests Sync Sep 5, 2018
.gitignore Added first uniit tests to project Jul 21, 2018
composer.json Added symfony/translation component Feb 11, 2019
composer.lock Version 0.1.0 Feb 11, 2019

WARNING: Under development!

Luthier Framework is a versatile PHP micro-framework for build APIs and small websites quickly. When we say "micro" we mean REALLY micro: in fact, only Composer and a single .php file is required to start.


  • Based on the Symfony components
  • Easy to learn and extend
  • Powerful and flexible router with middleware support
  • CSRF protection
  • JSON and XML response helpers
  • Validator with translated error messages
  • Dependency Injection container
  • Command Line Interface command creation
  • Built-in plain PHP template engine with Twig and Blade integration


  • PHP >= 7.1.8
  • Composer


Get Luthier Framework with composer:

composer require luthier/framework 


Basic example:

# your_app/index.php 
require 'vendor/autoload.php'; 
$app = new Luthier\Framework(); 
$app->get('/', function(){ 
    $this->response->write("Hello world!"); 
$app->group('api', function(){ 
    $this->get('/', function(){ 
        json_response(['message' => 'Welcome to Luthier Framework!']); 
    $this->get('about', function(){ 
        json_response(['version' => Luthier\Framework::VERSION]); 

Defining routes:

$app->get('foo/', function(){ 
    // Default template engine (will search for /foo.php file) 
$app->post('bar/', function(){ 
$app->match(['get','post'], 'baz/', function(){ 

Router parameters:

$app->get('hello/{name}', function($name){ 
    $this->response->write("Hello $name!"); 
// Optional parameters 
$app->get('about/{category?}', function($category = 'animals'){ 
    $this->response->write("Category: category"); 
// Regex parameters 
$app->get('website/{((en|es|fr)):lang}', function($lang){ 

Route middleware:

// Global middleware: 
$app->middleware(function($request, $response, $next){ 
    $response->write('Global <br>'); 
    $next($request, $response); 
// Global middleware (but not assigned to any route yet) 
$app->middleware('test', function($request, $response, $next){ 
    $response->write('Before route<br>'); 
    $next($request, $response); 
    $response->write('After route <br>'); 
$this->get('/', function(){ 
    $this->response->write('Route <br>') 
})->middleware('test'); // <- assign the 'test' middleware to this route 


Coming soon!

Related projects

  • Luthier CI: Improved routing, middleware support, authentication tools and more for CodeIgniter 3 framework
  • SimpleDocs: Dynamic documentation library for PHP which uses Markdown files


If you love our work, consider support us on Patreon