Rack for PHP
Rack'em is a micro-sized modular interface for PHP applications and web servers.
It is an attempt to provide the awesomeness that Rack has brought Ruby, to PHP.
Check out the documentation for stuff.
Features
- Tiny
- Provides a common interface for applications
- Painlessly stack application logic using "middleware"
- Environment values are consistent regardless of web server (see Rack specification)
- Run applications locally without other dependencies
Gets it
$ composer require rackem/rackem:@stable
A quick example
<?php
# config.php
return \Rackem::run(function($env) {
return array(
200,
array("Content-Type"=>"text/html"),
array("<h1>Hello, from Rack'em!</h1>")
);
});
$ vendor/bin/rackem
$ open http://localhost:9393