Answer the question
In order to leave comments, you need to log in
Symfony Routing Component v4 how to import second application yaml file (correct path)?
I have been using https://github.com/klein/klein.php all my life, it is convenient because everything you need to create web applications is already integrated and glued here. But recently it has become rarely updated, issues are growing, pull requests too.
Therefore, I decided to move to the symphony components.
To replace Klein I need:
pimple/pimple - DI
symfony/http-foundation + symfony/http-kernel - Request\Response
symfony/routing + symfony/config + symfony/yaml - symfony routes
/
templating - templating
all this is already glued together, and now I have to glue it all myself.
Well, ok, there is a kernel in a separate package, there is an application (several of them all use one kernel and extend it)
Kernel code
$fileLocator = new FileLocator([__DIR__]);
$loader = new YamlFileLoader($fileLocator);
$routes = $loader->load('routes.yaml');
... несколько маршрутов используемых ядром
# app routes
app_routes:
resource: '/app/routes.yaml'
$container = new ContainerBuilder();
$container->setParameter('app.routes_path', '../../server/app/routes.yaml');
app_routes:
resource: '%app.routes_path%'
Answer the question
In order to leave comments, you need to log in
The options won't work. The container and the router do not know anything about each other. In Symfony, all the magic is done in the FrameworkBundle: https://github.com/symfony/framework-bundle/blob/8...
Symfony 4 is a microframework, use it instead of building your own:
Also, you can pass in a FileLocator several ways:
See https://api.symfony.com/4.0/Symfony/Component/Conf...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question