Wilson is a PHP micro framework designed for simplicity and performance. It main features are:
- Annotation based routing
- Middleware
- Service Location
- HTTP Request/Response abstraction
- HTTP Caching
- Unit Testing
Its design is based around the Slim and Symfony frameworks, combining elements of both with the goal of creating system which is fast, correct, well documented, and simple.
At a glance, an application in the framework looks like this:
<?php
// File: public/index.php
require_once "/path/to/vendor/autoload.php";
$api = new Wilson\Api();
$api->resources = array("My\Restful\ResourceA");
$api->dispatch();
<?php
// File: src/My/Restful/ResourceA.php
namespace My\Restful;
class ResourceA
{
/**
* @route GET /resource-a/
*/
function getCollection($request, $response, $services)
{
$response->json(array("a", "b", "c"));
}
/**
* @route GET /resource-a/{file}.md
* @where file [a-z]+
*/
function getRecord($request, $response, $services)
{
$response->setBody(get_file($request->getParam("file")));
$response->setHeader("Content-Type", "text/plain");
}
}
Look at the wiki for a proper guide through the functionality.
This framework is a patchwork consisting of the ideas and pieces of code from numerous other projects:
- Josh Lockhart and other contributors to Slim Framework
- Fabien Potencier and other contributors to Symfony
- Matthew Weier O'Phinney and other contributors to phly/http
The code is under the MIT license. Third party code licences: