luky / slim
Library wrapper for PHP Slim framework
dev-master
2018-01-27 09:57 UTC
Requires
- php: >=7.1
- nette/utils: ^2.4
- slim/slim: ^3.9 | ^4.0
Requires (Dev)
- codeception/codeception: ^2.3
- jakub-onderka/php-console-highlighter: ^0.3.2
- jakub-onderka/php-parallel-lint: ^0.9.2
- mockery/mockery: ^1.0
- phpstan/phpstan: ^0.9.1
- slevomat/coding-standard: ^4.1
This package is auto-updated.
Last update: 2024-10-29 05:10:40 UTC
README
extensions:
route: Luky\Slim\SlimExtension
route:
default: MyUberApp\Route\DefaultRoute
routes:
- MyUberApp\Route\ArticleRoute
- MyUberApp\Route\UserRoute
Example PHP Wrapper
<?php declare(strict_types = 1);
namespace MyUberApp\Route;
class ExampleRoute
{
/** @var \ExampleFacade */
private $exampleFacade;
public function __construct(\ExampleFacade $exampleFacade)
{
$this->exampleFacade = $exampleFacade;
}
public function create(\Slim\App $app): void
{
$deps = $this;
$app->group(
'/article',
function () use ($app, $deps) {
$app->get(
'/feed',
function (\Slim\Http\Request $req, \Slim\Http\Response $res) use ($deps) {
return $res->withJson(
$deps->exampleFacade->feed()
);
}
);
}
);
}
}