rawebone/wilson

A PHP micro framework designed for simplicity and performance

1.0.0-alpha3 2015-01-28 22:12 UTC

This package is not auto-updated.

Last update: 2024-04-23 00:20:04 UTC


README

Author Latest Version Software License Build Status HHVM Status Coverage Status Quality Score Total Downloads SensioLabs Insight

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.

Usage

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.

Credits

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

License

The code is under the MIT license. Third party code licences: