Revision: Fri, 31 May 2024 16:10:39 GMT
v1.0 – outdated
This version of the documentation is outdated. Consider upgrading your project to Spiral Framework 3.12
Edit this page

Class Location

Spiral tokenizer provide way to locate classes based on parent, interface or used trait.

Request Spiral\Tokenizer\ClassesInterface as dependency to work with such methods.

Examples

Locate all controllers in application:

php
public function indexAction(ClassesInterface $classes)
{
    dump($classes->getClasses(ControllerInterface::class));
}

Locate all RequestFilters:

php
public function indexAction(ClassesInterface $classes)
{
    dump($classes->getClasses(RequestFilter::class));
}

Locate all classes with support of container shortcuts:

php
public function indexAction(ClassesInterface $classes)
{
    dump($classes->getClasses(SharedTrait::class));
}