This project is not covered by Drupal’s security advisory policy.
A Drupal port of the controller annotations from Symfony Framework which makes it a lot easier to create custom controllers based on annotations.
Quick example on what you can do with it:
namespace Drupal\acme\Controller;
use Drupal\controller_annotations\Configuration\Route;
use Drupal\controller_annotations\Configuration\Cache;
use Drupal\controller_annotations\Configuration\Template;
use Drupal\controller_annotations\Configuration\ParamConverter;
use Drupal\controller_annotations\Configuration\Method;
use Drupal\controller_annotations\Configuration\Security;
use Drupal\controller_annotations\Configuration\Title;
use Drupal\node\Entity\Node;
/**
* @Route("/articles")
* @Cache(expires="tomorrow")
*/
class ArticleController
{
/**
* @Route
* @Template
* @Security(permission="access content")
* @Title("My Title")
*/
public function indexAction()
{
$articles = ...;
return ['articles' => $articles];
}
/**
* @Route("/{id}", name="article_edit")
* @Method("GET")
* @ParamConverter("article", options={"bundle": "article"})
* @Template("acme:article:edit", vars={"article"})
* @Cache(smaxage="15")
* @Security(role="administrator")
*/
public function editAction(Node $article) { }
}
Install with composer require drupal/controller_annotations and enable from your admin panel or use drush: drush en controller_annotations -y.
View the full documentation, compatibility & tests + code coverage results on the Github page.
Supporting organizations:
Project information
Seeking new maintainer
The current maintainers are looking for new people to take ownership.- Project categories: Developer tools
2 sites report using this module
- Created by devmonk on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
