api-scout/api-scout

A library with a few tools, to auto document your API

Installs: 2 425

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 3

Forks: 2

Open Issues: 6

Type:symfony-bundle

V0.1.1 2023-10-15 19:50 UTC

This package is not auto-updated.

Last update: 2024-05-10 15:19:54 UTC


README

Introduction

This package uses the Symfony serializer

OpenapiSpecification.png

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