This package uses the Symfony serializer
- Enjoy the magic of an auto generated Swagger API Documentation
- MapRequestPayload and MapQueryString to deserialize your Request
- Serialize automatically your Response by returning an object to the Controller
- Nice Symfony Validation Response
- A Pagination tool to help you with your collections
ApiScout will greatly help you develop your api without reinventing the wheel
You can choose to use those tools as well as not to use them without having to fight against ApiScout.
composer require api-scout/api-scout
<?php
# config/bundles.php
return [
// ...
ApiScout\Bridge\Symfony\Bundle\ApiScoutBundle::class => ['all' => true]
];
# config/routes.yaml
api_scout_swagger_ui:
path: /api/docs.{_format}
controller: api_scout.swagger_ui.action
methods: GET
format: html
Use one of the available attribute methods as follows
<?php
namespace ApiScout\Controller;
use ApiScout\Attribute\Get;
final class GetBookController
{
#[Get('/books')]
public function __invoke(string $id): BookOutput
{
return new BookOutput(
'PHPStan',
'There is only one level with PHPStan. The level max.'
);
}
}
Your api specification is now available at: /api/docs
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate. For more information see the contributing guide
Created by Marvin Courcier.
This library is sponsored by Alximy