2017 © Pedro Peláez
 

library yarf

Yet another routing framework

image

yarf/yarf

Yet another routing framework

  • Sunday, December 18, 2016
  • by jannis
  • Repository
  • 1 Watchers
  • 0 Stars
  • 184 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Yet another routing framework

Build Status Coverage Status Code Climate, (*1)

Latest Stable Version Latest Unstable Version, (*2)

A simple but powerful routing framework for PHP., (*3)

Basic usage

To create a new router responding to the root url of your server, simply do the following:, (*4)

$router = new \Yarf\Router();

$classMap = [
  "" => IndexPage::class
];

$router->route($classMap);

Page types

There are three basic page types. HtmlPage, JsonPage and TextPage. Each of them is subclassable and meant to return either html, json or plain text. The content type for the http response is set appropriately., (*5)

Features

Rest support

Create a restful service with this framework is dead simple. Here is a quick example:, (*6)


use Yarf\response\Response; class UserApi extends Yarf\page\JsonPage { private $user; public function initialize() { $this->user = ...; } public function get(Response $response) { $response->result($this->user); return $response; } public function post(Response $response) { $this->user->update(...); $response->result($this->user); return $response; } public function delete(Response $response) { $response->result($this->user->delete()); return $response; } }

URI variables

When configuring your routes, route elements using a scheme like {variable} will be interpreted as variable uri parts., (*7)


use Yarf\response\Response; class UserApi extents \Yarf\page\JsonPage { public function get(Response $response, $userId) { $response->result(UserCache::get($userId)); return $response; } } $classMap = [ "api" => [ "user" => [ "{userId}" => UserApi::class ] ] ] $router = new Yarf\Router(); $router->route($classMap);

The Versions

18/12 2016

dev-master

9999999-dev

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

18/12 2016

0.0.9

0.0.9.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

11/12 2016

0.0.8

0.0.8.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

01/12 2016

0.0.7

0.0.7.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

01/12 2016

0.0.6

0.0.6.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

30/11 2016

0.0.5

0.0.5.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

30/11 2016

0.0.4

0.0.4.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

29/11 2016

0.0.3

0.0.3.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

29/11 2016

0.0.2

0.0.2.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

18/11 2016

0.0.1

0.0.1.0

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink

07/08 2016

dev-chain-page-maps

dev-chain-page-maps

Yet another routing framework

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5
  • ext-mbstring *

 

The Development Requires

by Jannis Fink