Skip to content
An HTTP microframework written on top of Labrador.
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.

Labrador HTTP

Travis GitHub license GitHub release

A PSR-7 compliant microframework built on top of Labrador and FastRoute. Take advantage of a highly extensible, spec-compliant library and easily integrate with existing PSR-7 Middleware and a multitude of open source libraries.


We recommend you use Composer to install the library.

composer require cspray/labrador-http

Quick Start

The quickest way to get started is to use the Cspray\Labrador\Http\bootstrap() function. This registers error and exception handlers, creates an Auryn\Injector and wires the container for the library's required services.


require_once __DIR__ . '/vendor/autoload.php';

use Cspray\Labrador\Http\Engine;
use Zend\Diactoros\Response\TextResponse;
use function Cspray\Labrador\Http\bootstrap;

$injector = bootstrap();

$engine = $injector->make(Engine::class);

$engine->get('/', new TextResponse('hello world'));
$engine->get('/closure', function() {
    return new TextResponse('Because of course you can do this');

// You'd really want to put this in its own file
class MyController {
    public function someMethodThatYouName() {
        return new TextResponse('And, yea, from the controller object too');

$engine->get('/controller-object', MyController::class . '#someMethodThatYouName');

You can’t perform that action at this time.