C
C
cryingen2021-10-21 21:12:49
PHP
cryingen, 2021-10-21 21:12:49

How to initialize a Symfony router in a project?

Guys, the question is:
How can I build routing in a project using the Symfony routing component separately?
For example, there are controllers in the src/Controllers directory. It is necessary that they are loaded at a specific URI using the php8.0 attributes:

#[Route('/path', name: 'action')]
    public function someAction()
    {
        // ...
    }

Therefore, how should the routing be initialized for it to work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maksim Fedorov, 2021-10-21
@Maksclub

You need to install a couple more packages:

symfony/config
symfony/cache
doctrine/annotations

in fact, with the config, you will almost start a symphony in a standard installation, not counting the Request / Response from the Symfony Foundation ... even then you
can take the symphony and install simpler packages, such as Aura / Slim, when registering the application, new routes are simply added

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question