ruwork / api-bundle
Ruwork API Bundle
Installs: 7 181
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 1
Type:symfony-bundle
Requires
- php: ^7.1.3
- doctrine/annotations: ^1.6
- symfony/dependency-injection: ^3.4 || ^4.0
- symfony/http-foundation: ^3.4 || ^4.0
- symfony/http-kernel: ^3.4 || ^4.0
- symfony/routing: ^3.4 || ^4.0
- twig/twig: ^2.4
Requires (Dev)
- symfony/form: ^3.4 || ^4.0
- symfony/framework-bundle: ^3.4 || ^4.0
- symfony/serializer: ^3.4 || ^4.0
This package is auto-updated.
Last update: 2023-06-29 01:36:08 UTC
README
Routing
_api: resource: '@AppBundle/Controller/Api/' type: annotation prefix: /api defaults: _format: json # _ruwork_api attribute enables api listeners for this route _ruwork_api: true
Controller
<?php namespace AppBundle\Controller\Api; use Ruwork\ApiBundle\Annotations as Api; use Ruwork\ApiBundle\Controller\AbstractApiController; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; /** * @Route("/test") */ class TestController extends AbstractApiController { /** * @Method("GET") * @Route("") * @Api\Doc("Test method", requiresAuth=true, description="<p>Test method description.</p>", * params={@Api\Param("id", required=true, format="int", description="<p>Description.</p>")}, * block="test", displayRoles={"ROLE_API_TEST"} * ) */ public function indexAction() { return ['test' => 1]; } }
Templating
twig: paths: "%kernel.project_dir%/vendor/ruwork/api-bundle/Resources/views": RuworkApiOriginal
{# app/Resources/RuworkApiBundle/views/docs.html.twig #} {% extends '@RuworkApiOriginal/docs.html.twig' %} {% block title 'Website API' %} {% block test %} Override the whole method card {% endblock %} {% block test_description %} Override method description {% endblock %} {% block test_param_id_description %} Override parameter description {% endblock %}