Skip to content

Help you document your api and serialize your output

License

Notifications You must be signed in to change notification settings

api-scout/api-scout

Repository files navigation

ApiScout 🤠

Introduction

This package uses the Symfony serializer

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.

Installation

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

Usage

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

Book OpenApi

Methods

OpenApi

Advanced

Migrate to Api-Scout

Contributing

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

Credits

Created by Marvin Courcier.

This library is sponsored by Alximy