На мой взгляд, тут бандл будет лишним, решается в пару действий
config/services.yaml
parameters:
robots.txt:
- 'User-agent: *'
- 'User-agent: Google'
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: true
bind:
$userAgentParams: '%robots.txt%'
src/Controller/RobotsTxtController.php
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("robots.txt")
*/
class RobotsTxtController
{
/**
* @var array
*/
private $userAgentParams;
public function __construct(array $userAgentParams)
{
$this->userAgentParams = $userAgentParams;
}
public function __invoke(): Response
{
return new Response(implode(PHP_EOL, $this->userAgentParams));
}
}