yoanm / symfony-jsonrpc-http-server-swagger-doc
Symfony bundle for easy JSON-RPC server Swagger 2.0 documentation
Installs: 4 488
Dependents: 0
Suggesters: 3
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: ^8.0
- symfony/config: ^4.4 || ^5.4 || ^6.0
- symfony/dependency-injection: ^4.4 || ^5.4 || ^6.0
- symfony/event-dispatcher-contracts: ^1.0 || ^2.0
- symfony/http-kernel: ^4.4 || ^5.4 || ^6.0
- yoanm/jsonrpc-http-server-swagger-doc-sdk: ^v1.0
- yoanm/jsonrpc-server-doc-sdk: ^v1.0
- yoanm/symfony-jsonrpc-http-server-doc: ^1.1
Requires (Dev)
- behat/behat: ^3.9.0
- dvdoug/behat-code-coverage: ^5.0
- matthiasnoback/symfony-config-test: ^4.0
- matthiasnoback/symfony-dependency-injection-test: ^4.0
- phpspec/prophecy: ^1.15
- phpspec/prophecy-phpunit: ^2.0
- phpunit/php-code-coverage: ^9.2.4
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.5
- symfony/event-dispatcher: ^4.4 || ^5.4 || ^6.0
- symfony/framework-bundle: ^4.4 || ^5.4 || ^6.0
- symfony/routing: ^4.4 || ^5.4 || ^6.0
- yoanm/php-unit-extended: ^2.0.2
Suggests
- yoanm/symfony-jsonrpc-http-server: Symfony Bundle to convert an HTTP json-rpc request into HTTP json-rpc response
This package is auto-updated.
Last update: 2024-11-29 17:12:48 UTC
README
Symfony bundle for easy JSON-RPC server Swagger 2.0 documentation
Symfony bundle for yoanm/jsonrpc-http-server-swagger-doc-sdk
Versions
- Symfony v3/4 - PHP >=7.1 :
^v0.X
- Symfony v4/5 - PHP >=7.2 :
^v1.0
How to use
Once configured, your project is ready to handle HTTP GET
request on /doc/swagger.json
endpoint. Result will be a swagger compatible file.
See below how to configure it.
Configuration
Behat demo app configuration folders can be used as examples.
-
Add the bundles in your config/bundles.php file:
// config/bundles.php return [ ... Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Yoanm\SymfonyJsonRpcHttpServer\JsonRpcHttpServerBundle::class => ['all' => true], Yoanm\SymfonyJsonRpcHttpServerDoc\JsonRpcHttpServerDocBundle::class => ['all' => true], Yoanm\SymfonyJsonRpcHttpServerSwaggerDoc\JsonRpcHttpServerSwaggerDocBundle::class => ['all' => true], ... ];
-
Configure
yoanm/symfony-jsonrpc-http-server
as described on yoanm/symfony-jsonrpc-http-server documentation. -
Configure
yoanm/symfony-jsonrpc-http-server-doc
as described on yoanm/symfony-jsonrpc-http-server-doc documentation. -
Query your project at
/doc/swagger.json
endpoint and you will have a swagger json documentation file of your server.
Event
You are able to enhance resulting documentation by listening on json_rpc_http_server_swagger_doc.array_created
event.
See below an example of listener service configuration:
method_doc_created.listener: class: Full\Namespace\DocCreatedListener # <-- replace by your class name tags: - name: 'kernel.event_listener' event: 'json_rpc_http_server_swagger_doc.array_created' method: 'enhanceMethodDoc' # <-- replace by your method name
You will receive an event of type SwaggerDocCreatedEvent
.
You can take example on Behat DocCreatedListener