uni-method / symfony-bundle
本包最新版本(0.1.7)没有提供许可证信息。
Jsonapi symfony实现包
0.1.7
2022-11-27 22:53 UTC
Requires
- php: >=7.4
- ext-json: *
- doctrine/annotations: >=1.12
- doctrine/orm: ^2.8|^3.0
- symfony/config: ^4.4|^5.0|^6.0
- symfony/dependency-injection: ^4.4|^5.0|^6.0
- symfony/http-kernel: ^4.4|^5.0|^6.0
- symfony/validator: ^5.2|^6.0
- symfony/yaml: ^4.4|^5.0|^6.0
- uni-method/jsonapi-mapper: ^0.2.7
Requires (Dev)
- roave/security-advisories: dev-master
- symfony/framework-bundle: ^4.4|^5.0|^6.0
- symfony/phpunit-bridge: ^4.4|^5.0|^6.0
Conflicts
- twig/twig: <1.41|<2.10
This package is auto-updated.
Last update: 2024-09-28 02:48:05 UTC
README
请确保已全局安装Composer,具体安装方法请参考Composer文档中的安装章节。
使用Symfony Flex的应用程序
打开命令行,进入您的项目目录并执行
$ composer require uni-method/symfony-bundle
未使用Symfony Flex的应用程序
步骤1:下载Bundle
打开命令行,进入您的项目目录并执行以下命令以下载此Bundle的最新稳定版本
$ composer require uni-method/symfony-bundle
步骤2:启用Bundle
然后,通过将其添加到项目config/bundles.php
文件中注册的Bundle列表来启用该Bundle
// config/bundles.php return [ // ... UniMethod\Bundle\UniMethodBundle::class => ['all' => true], ];
步骤3:Bundle选项
如果不存在,创建config/packages/uni_method.yaml
uni_method: default_path: '%kernel.project_dir%/config/jsonapi' # path to entities config prefix: 'v' # prefix for version forexample /v1/user/ available: # all available versions - 1 # version (subfolder in default_path)
步骤4:创建第一个版本(v1)
# config/jsonapi/1/config.yml entities: user: class: 'App\Entity\User' description: 'Just a user' attributes: id: getter: 'getId()' type: integer email: getter: 'getEmail()' type: string paths: - item: user method: list
步骤5:启用Bundle路由
# config/routes.yaml app_extra: resource: . type: extra