A slim router for PHP Web Applications

1.0.1 2021-05-15 15:24 UTC

This package is auto-updated.

Last update: 2024-05-23 19:24:48 UTC


README

Travis: Build Status License: MIT

Yet another Micro-framework for PHP.

Installation

composer require jabernardo/calf

Hello World

<?php

require("vendor/autoload.php");

$app = new \Calf\App();

$home = new \Calf\HTTP\Route('/', function($req, $res) {
        return $res->write('Hello World!');
    });

$app->add($home);

$app->run();

Configuring Web Server

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

Running...

php -S localhost:8888 index.php

Testing

phpunit

Learn more

Please see the project's wiki page here.

License

The calf is open-sourced software licensed under the MIT license.