From ecbd3391f2241dabf03c90ed7d43621286336901 Mon Sep 17 00:00:00 2001 From: kawanamiyuu Date: Tue, 14 Jul 2020 00:05:00 +0900 Subject: [PATCH] update README --- README.md | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d107acb..30bf69d 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,31 @@ [![badge](https://github.com/kawanamiyuu/K9u.Framework/workflows/CI/badge.svg)](https://github.com/kawanamiyuu/K9u.Framework/actions?query=workflow%3ACI) +## Overview + ```php -use Acme\BarMiddleware; -use Acme\BuzRequestHandler; -use Acme\FooMiddleware; use K9u\Framework\ApplicationInterface; use K9u\Framework\CachedInjectorFactory; +use K9u\Framework\Demo\FakeMiddleware; +use K9u\Framework\Demo\FakeRequestHandler; use K9u\Framework\FrameworkModule; use Laminas\Diactoros\ServerRequestFactory; +use Ray\Di\AbstractModule; + +class AppModule extends AbstractModule +{ + protected function configure() + { + $middlewares = [ + FakeMiddleware::class, + FakeRequestHandler::class + ]; -$module = new FrameworkModule([ - FooMiddleware::class, - BarMiddleware::class, - BuzRequestHandler::class, -]); + $this->install(new FrameworkModule($middlewares)); + } +} +$module = new AppModule(); $injector = (new CachedInjectorFactory('/path/to/cache'))($module); $app = $injector->getInstance(ApplicationInterface::class); @@ -26,3 +36,16 @@ $request = ServerRequestFactory::fromGlobals(); $app($request); // handle request and emit response ``` + +## Run demo application + +See [demo](demo/). + +```bash +git clone https://github.com/kawanamiyuu/K9u.Framework.git +cd K9u.Framework +composer install +composer serve:demo + +# access to http://localhost:8080 +```