weew/router-entities-resolver
Composer 安装命令:
composer require weew/router-entities-resolver
包简介
Resolves doctrine entities in the weew/router package.
README 文档
README
Table of contents
Installation
composer require weew/router-entities-resolver
Introduction
This package provides a convenient way to resolve doctrine entities in the weew/router package.
Usage
Pick an identifier for the entity to be referenced in the router and register a new resolver.
$router = new Router(new Container()); $resolver = new EntitiesResolver($router); $resolver ->resolve('user', UserRepository::class) ->resolve('role', RoleRepository::class);
Now you can resolve entities as with any regular parameter resolver.
$router->get('api/v1/users/{user}', function(User $user) { // entitiy will be injected instead of a user id }); // or $route = $router->match(HttpRequestMethod::GET, new Url('api/v1/users/1')); $user = $route->getParameter('user');
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-21