ruvents / api-bundle
Ruwork API Bundle
Installs: 28
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Type:symfony-bundle
Requires
- php: ^7.0.8
- doctrine/annotations: ^1.4
- sensio/framework-extra-bundle: ^3.0 || ^4.0
- symfony/dependency-injection: ^3.3 || ^4.0
- symfony/form: ^3.3 || ^4.0
- symfony/http-foundation: ^3.3 || ^4.0
- symfony/http-kernel: ^3.3 || ^4.0
- symfony/routing: ^3.3 || ^4.0
- symfony/serializer: ^3.3 || ^4.0
- twig/twig: ^2.0
This package is not auto-updated.
Last update: 2020-08-22 06:06:51 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 %}