openxtrem / oas-generator
4.0.0
2024-06-03 20:16 UTC
Requires
- php: 8.2.* | 8.3.*
- ext-json: *
- cebe/php-openapi: 1.7.*
- symfony/routing: ^6.4
Requires (Dev)
- openxtrem/coding-standard: ^1.0.0
- phpunit/phpunit: 9.5.*
- symfony/var-dumper: ^6.4
This package is auto-updated.
Last update: 2024-09-03 18:55:35 UTC
README
关于
将 Symfony 路由集合转换为 Open Api 规范。使用 cebe/php-openapi 进行 OAS 验证。
如何使用
$oas = new Specifications();
$oas->setVersion('1.0.0')
->setTitle('OX APIs documentation')
->setDescription('This documentation ...')
->setContact('admin', 'admin@info.fr')
->setLicense('GPL', 'https://openxtrem.com/licenses/gpl.html')
->addTag('system', 'This is a tag');
->addServer('http://lorem-ipsum.fr', 'description')
->addSecurity(
'Token', 'apiKey', 'header token', [
'in' => 'header',
'name' => 'X-OXAPI-KEY',
])
->addSchema(new Scheam('lorem', 'object'));
$routes = new RouteCollection(); // your routes
$generator = new Generator($oas, $routes);
$documentation = $generator->generate();
如何测试?
vendor/bin/phpunit -c phpunit.xml
需要帮助吗?
https://openapis.org.cn/