thephpguys/headless-bundle

安装: 0

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

v0.0.2 2022-07-18 11:31 UTC

This package is auto-updated.

Last update: 2024-09-29 06:14:46 UTC


README

确保全局已安装 Composer,具体请参考 Composer 文档中的安装章节

使用 Symfony Flex 的应用程序

打开命令行,进入你的项目目录并执行

$ composer require thephpguys/headless-bundle

不使用 Symfony Flex 的应用程序

步骤 1:下载 Bundle

打开命令行,进入你的项目目录并执行以下命令以下载此 Bundle 的最新稳定版本

$ composer require thephpguys/headless-bundle

步骤 2:启用 Bundle

然后,通过将其添加到项目 config/bundles.php 文件中已注册的 Bundle 列表中来启用该 Bundle

// config/bundles.php

return [
    // ...
    Tpg\HeadlessBundle\TpgHeadlessBundle::class => ['all' => true],
];

步骤 3:添加路由

然后,通过将其添加到项目 config/routes.yaml 文件中的路由配置中来添加路由

# config/routes.yaml
# ...
headless:
    resource: '@TpgHeadlessBundle/Resources/config/routing.yaml'
    prefix: '/api'

步骤 4:添加集合

然后,创建项目中的 config/packages/tpg_headless.yaml 文件并添加你的实体

# config/packages/tpg_headless.yaml

tpg_headless:
    collections:
        pet: App\Entity\Pet
        owner: App\Entity\Owner