次のようにインストールを開始しました:
https://symfony.com/doc/4.x/bundles/NelmioApiDocBundle/index.html
ステップ 1.
`composer require nelmio/api-doc-bundle` - Thats OK
ステップ2。
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
];
}
}
しかし、カーネルを拡張する AppKernel はありません。
`$contents = require $this->getProjectDir().'/config/bundles.php';`を使用して **カーネル** を持っている
ので、**/config/bundles.php** に追加しました。
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
ステップ 3. config/routes.yaml
に追加しました
# config/routes.yaml
app.swagger_ui:
path: /api/doc
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger_ui }
ステップ 4. config/packages/nelmio_api_doc.yamlを
作成しました
nelmio_api_doc:
areas:
path_patterns: # an array of regexps
- ^/api(?!/doc$)
host_patterns:
- ^api\.
その後、mysite/api/doc に Swagger のページが表示されるはずです
が、github にリンク 'NelmioApiDocBundle' のある白いページしか表示され
ません。