Skip to content

Commit

Permalink
Merge pull request #7 from AlexandreGerault/feature/middleware
Browse files Browse the repository at this point in the history
Feature/middleware
  • Loading branch information
AlexandreGerault authored Jul 13, 2021
2 parents 40ea71d + 7b5b51d commit 180bc8e
Show file tree
Hide file tree
Showing 28 changed files with 735 additions and 46 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
"psr/simple-cache": "^1.0",
"ext-pdo": "*",
"psr/http-server-handler": "^1.0",
"beberlei/assert": "^3.3"
"beberlei/assert": "^3.3",
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"pestphp/pest": "^1.0",
"symfony/var-dumper": "^5.2",
"guzzlehttp/guzzle": "^7.2",
"phpstan/phpstan": "^0.12.82",
"jetbrains/phpstorm-attributes": "^1.0",
"friendsofphp/php-cs-fixer": "^v3.0.0"
"friendsofphp/php-cs-fixer": "^v3.0.0",
"pestphp/pest-plugin-mock": "^1.0"
}
}
257 changes: 255 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AGerault\Framework\Contracts\Core;
namespace AGerault\Framework\Contracts\HTTP;

use Psr\Http\Server\RequestHandlerInterface;

Expand Down
8 changes: 8 additions & 0 deletions src/AGerault/Contracts/HTTP/MiddlewareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace AGerault\Framework\Contracts\HTTP;

interface MiddlewareInterface extends \Psr\Http\Server\MiddlewareInterface
{

}
12 changes: 12 additions & 0 deletions src/AGerault/Contracts/HTTP/MiddlewarePipeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace AGerault\Framework\Contracts\HTTP;

use Generator;

interface MiddlewarePipeInterface
{
public function push(MiddlewareInterface $middleware): void;

public function generator(): Generator;
}
5 changes: 5 additions & 0 deletions src/AGerault/Contracts/Routing/RouteInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace AGerault\Framework\Contracts\Routing;

use AGerault\Framework\Contracts\HTTP\MiddlewareInterface;

interface RouteInterface
{
public function name(): string;
Expand All @@ -27,4 +29,7 @@ public function url(): string;
public function parameters(): array;

public function setParameter(string $parameterName, mixed $value): void;

/** @return MiddlewareInterface[] */
public function middlewares(): array;
}
8 changes: 8 additions & 0 deletions src/AGerault/Contracts/Routing/UrlMatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

namespace AGerault\Framework\Contracts\Routing;

use AGerault\Framework\Routing\Exceptions\RouteNotFoundException;

interface UrlMatcherInterface
{
/**
* @param string $uri
* @param string $method
* @return RouteInterface
* @throws RouteNotFoundException
*/
public function match(string $uri, string $method): RouteInterface;
}
6 changes: 5 additions & 1 deletion src/AGerault/Contracts/Session/SessionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

namespace AGerault\Framework\Contracts\Session;

interface SessionInterface
use ArrayAccess;

interface SessionInterface extends ArrayAccess
{
public function start(): void;

public function has(string $key): bool;

public function get(string $key): mixed;
Expand Down
Loading

0 comments on commit 180bc8e

Please sign in to comment.