nicolas-cajelli / api-documenter
0.1.0
2017-08-14 19:44 UTC
Requires
- php: >=7.1
- jan-swiecki/simple-annotations: >=0.3.1
- tebru/gson-php: >=0.4.0
This package is not auto-updated.
Last update: 2025-03-30 06:57:27 UTC
README
This library is intended to automatically build documentation with the smallest friction possible in a defined scope (see Scope) If your use case doesn't match the current scope, please create an issue/pr
Scope
APIS running:
- Php 7.1 or higher (required by gson)
- Isolated Routes file with structure as Slim framework
Install
composer require nicolas-cajelli/api-documenter
Run (Default)
./vendor/bin/build-documentation src/routes.php "My api name" "/my/api/basepath"
Run (Custom)
Create a .php in your project:
<?php $loader = require 'vendor/autoload.php'; # Required by gson library \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$loader, 'loadClass']); $app = new \Documenter\FakeApp('My api name'); $app->setBasePath('/my/api/basepath'); $app->setDescription('My api description'); $app->setVersion('1.0.0'); require 'src/routes.php'; $formatter = new \Documenter\Formatter\SwaggerFormatter(); echo $formatter->getDocumentation($app);