Dependency-less PHP Micro Framework with a focus on simplicity to get you prototyping and delivering new APIs and Websites quickly.
<?php // example basic index.php
require_once __DIR__ . '/../../vendor/autoload.php';
(function() {
$app = new Limon\App(
new Limon\Kernel(
new ActionResolver
)
);
/** @var Psr\Http\Message\ServerRequestInterface $request */
$request = captureServerRequest();
// Reguster a handler, this can be replaced
// with middleware that sets the request-handler attribute
// with a routing package
$request = $request->withAttribute(
'requst-handler',
fn(ServerRequestInterface $request) => new Response()
);
$res = $app->handle($request);
Limon\emit($res);
})();
This getting started is based on XAMPP
- Require the composer package
composer require tylersriver/limon
- Create index.php at Apache web root
- Create .htaccess with below
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
Limon adheres to the PSR standards for request, response, middleware handling and can be used with any compliant packages. There are some default packages wired to the example skeleton app here
Yocto is built around the idea of ADR and includes a base Action interface that can be implemented for splitting your http routes into separate objects.