summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold Daniels <arnold@jasny.net>2017-06-08 20:48:50 +0200
committerArnold Daniels <arnold@jasny.net>2017-06-08 20:48:50 +0200
commitafb6318a82f31504410e0a9eaa510dfc546d2e9a (patch)
tree79e7e4d6f78bf83c0a7dedf89054f7e76545a1c2
parent74e5f6da3bec960f3b159d489d72ddd145432a5a (diff)
downloadrouter-afb6318a82f31504410e0a9eaa510dfc546d2e9a.zip
router-afb6318a82f31504410e0a9eaa510dfc546d2e9a.tar.gz
router-afb6318a82f31504410e0a9eaa510dfc546d2e9a.tar.bz2
Added some text to the README (WIP)
Added badges to README
-rw-r--r--README.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/README.md b/README.md
index 54e1f66..77debaf 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,13 @@ Jasny Router
[![Build Status](https://secure.travis-ci.org/jasny/router.png?branch=master)](http://travis-ci.org/jasny/router)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jasny/router/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jasny/router/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/jasny/router/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/jasny/router/?branch=master)
+[![SensioLabsInsight](https://insight.sensiolabs.com/projects/a1a1745c-1272-46a3-9567-7bbb52acda5a/mini.png)](https://insight.sensiolabs.com/projects/a1a1745c-1272-46a3-9567-7bbb52acda5a)
+[![Packagist Stable Version](https://img.shields.io/packagist/v/jasny/router.svg)](https://packagist.org/packages/jasny/router)
+[![Packagist License](https://img.shields.io/packagist/l/jasny/router.svg)](https://packagist.org/packages/jasny/router)
+
+
+Jasny Router is a versatile PSR-7 compatible router. It decouples the way to determine a route, from the routing and
+from running the routed action. The router supports double pass middleware.
Installation
@@ -14,3 +21,28 @@ composer:
composer require jasny/router
+Basic Usage
+---
+
+```php
+use Jasny\Router;
+use Jasny\Router\Routes\Glob as Routes;
+use Jasny\HttpMessage\ServerRequest;
+use Jasny\HttpMessage\Response;
+
+$routes = new Routes([
+ '/' => function($request, $response) {
+ $response->getBody()->write('Hello world');
+ return $response;
+ },
+]);
+
+$router = new Router($routes);
+$router->handle(new ServerRequest()->withGlobalEnvironment(), new Response());
+```
+
+Routes
+---
+
+When creating a `Router`, you need to pass a object that implements the `RoutesInterface`. Routes should be seen as a
+collection of routes, with the ability to select one of those routes based on the server request.