Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kawanamiyuu committed Jul 13, 2020
1 parent 9da6dbe commit ecbd339
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
```

0 comments on commit ecbd339

Please sign in to comment.