Add to composer.json (for learning/testing only):
composer require avinsol/test-bundle --dev
Note: Exclude from production via composer.json config.exclude-dev or .gitignore.
Enable in config/bundles.php (temporarily):
return [
// ...
Avinsol\TestBundle\AvinsolTestBundle::class => ['dev' => true],
];
First Use Case:
{{ dump(_context) }} {# Dump full template context #}
symfony/stopwatch integration (from require-dev) to profile routes:
php bin/console debug:router | grep "test"
Twig Debugging:
twig.configurator in config/packages/twig.yaml to enable strict checks:
twig:
debug: true
strict_variables: true
{{ avinsol_test_extension.some_method() }}
Dependency Injection Learning:
php bin/console debug:container avinsol
# config/services.yaml
services:
App\Service\TestService:
arguments:
$someParam: '%env(TEST_VAR)%'
Routing Experiments:
TestRouter (if implemented):
// src/Controller/TestController.php
use Avinsol\TestBundle\DependencyInjection\TestRouter;
public function testRoute(TestRouter $router) {
$routes = $router->getRoutes();
// Log/inspect routes for learning
}
Integration with Symfony’s Dev Tools:
symfony/stopwatch dev dependency to mimic the bundle’s profiling:
use Symfony\Component\Stopwatch\Stopwatch;
$stopwatch = new Stopwatch();
$stopwatch->start('test_event');
// ... code ...
$event = $stopwatch->stop('test_event');
Security Risks:
app.php or prod environments.env('APP_ENV') === 'dev' guards in custom code.Missing Documentation:
src/Resources/config/services.yaml (service definitions).src/DependencyInjection/ (compiler passes, extensions).src/Twig/ (custom Twig extensions).Dependency Conflicts:
symfony new test-project "5.4.*"
composer require avinsol/test-bundle --dev
Twig Auto-Reloading:
php bin/console cache:clear
find vendor/avinsol/test-bundle -type f -name "*.php" | xargs grep -l "class\|function"
// src/DependencyInjection/Compiler/TestPass.php
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class TestPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
// Modify services added by the bundle
}
}
src/Kernel.php:
protected function build(ContainerBuilder $container) {
$container->addCompilerPass(new TestPass());
}
Custom Twig Extensions:
{% extends 'base.html.twig' %}
{% block custom_test %}
{{ parent() }}
{{ include('avinsol_test/_custom_extension.html.twig') }}
{% endblock %}
Event Listeners:
kernel.request):
// src/EventListener/TestListener.php
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
class TestListener {
public function onKernelRequest(RequestEvent $event) {
if ($event->isMainRequest()) {
// Log/inspect request for learning
}
}
}
Register in config/services.yaml:
services:
App\EventListener\TestListener:
tags:
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
Configuration Overrides:
config/packages/avinsol_test.yaml:
avinsol_test:
some_setting: "custom_value"
How can I help you explore Laravel packages today?