aequation/wire
Aequation Wire Bundle is a Symfony 7.2 toolbox bundle by Aequation Webdesign. Installs via symfony composer require aequation/wire and provides shared utilities for your Symfony apps. GitHub: manu7772/aew-wire
Installation:
composer require aequation/wire
Ensure your project is using Symfony 7.2 (verified via php bin/console --version).
Enable the Bundle:
Add to config/bundles.php:
return [
// ...
Aequation\WireBundle\AequationWireBundle::class => ['all' => true],
];
First Use Case:
Aequation\WireBundle\Service\BaseService) for common logic like logging, configuration, or utility methods.config/packages/aequation_wire.yaml (auto-generated) for default settings. Override as needed:
aequation_wire:
debug: '%kernel.debug%'
default_locale: 'en'
Key Entry Points:
src/Service/ in the bundle for reusable components.php bin/console list aequation to see available CLI tools (e.g., aequation:debug:config).{{ aequation_wire_utility() }} in templates for helper functions.Service Integration:
BaseService or domain-specific services (e.g., LoggerService) into controllers/services:
use Aequation\WireBundle\Service\LoggerService;
class MyController extends AbstractController {
public function __construct(private LoggerService $logger) {}
}
# config/services.yaml
services:
Aequation\WireBundle\Service\LoggerService:
arguments:
$logPath: '%kernel.project_dir%/var/log/custom.log'
Configuration Management:
Aequation\WireBundle\DependencyInjection\Configuration to merge custom settings:
$config = $this->container->getParameter('aequation_wire.config');
config/packages/dev/aequation_wire.yaml).CLI Automation:
php bin/console aequation:debug:config to inspect loaded configurations.src/Command/ and tagging it:
// src/Command/MyCommand.php
class MyCommand extends Command {
protected static $defaultName = 'aequation:my:command';
}
Twig Utilities:
aequation_wire_date_format) or add custom ones by extending the bundle’s TwigExtension:
// src/Twig/AppExtension.php
class AppExtension extends AbstractExtension {
public function getFunctions(): array {
return [
new TwigFunction('my_custom_function', [$this, 'customLogic']),
];
}
}
Register in services.yaml:
services:
App\Twig\AppExtension:
tags: ['twig.extension']
Event Listeners:
aequation.wire.init (check EventDispatcher in the bundle’s Resources/config/services.xml):
// src/EventListener/MyListener.php
class MyListener {
public function onInitEvent(InitEvent $event) {
// Custom logic
}
}
Tag in services.yaml:
services:
App\EventListener\MyListener:
tags:
- { name: 'kernel.event_listener', event: 'aequation.wire.init' }
composer.json for recipe compatibility.vendor/ path is correctly symlinked or published.$container->set('Aequation\WireBundle\Service\LoggerService', $this->createMock(LoggerService::class));
Symfony Version Mismatch:
7.2.* in composer.json or fork the bundle for compatibility.Configuration Overrides:
aequation_wire.yaml is missing, the bundle uses defaults but may log warnings. Always check var/log/dev.log.debug: true in config to enable verbose logging for troubleshooting.Service Autowiring:
BaseService may conflict with custom services of the same name. Use fully qualified names:
use Aequation\WireBundle\Service\BaseService as WireBaseService;
Twig Extensions:
app_my_function).Commands:
aequation:my:command if the bundle adds aequation:my:task).Log Inspection:
var/log/dev.log for bundle-related entries. Use:
php bin/console debug:container | grep aequation
php bin/console debug:config aequation_wire
Dependency Graph:
php bin/console debug:container --parameters --env=dev | grep -A5 "Aequation"
Event Debugging:
php bin/console debug:event-dispatcher
php bin/console debug:event-dispatcher | grep "aequation.wire"
Custom Services:
// src/Service/CustomLoggerService.php
class CustomLoggerService extends \Aequation\WireBundle\Service\LoggerService {
public function logCustom(string $message) {
$this->log($message, 'custom');
}
}
services.yaml:
services:
App\Service\CustomLoggerService:
decorates: 'Aequation\WireBundle\Service\LoggerService'
arguments: ['@App\Service\CustomLoggerService.inner']
Compiler Passes:
// src/DependencyInjection/Compiler/MyPass.php
class MyPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
$definition = $container->findDefinition('Aequation\WireBundle\Service\BaseService');
$definition->addMethodCall('setCustomOption', ['value']);
}
}
services.yaml:
services:
App\DependencyInjection\Compiler\MyPass:
tags: [{ name: 'compiler.pass' }]
Configuration Schema:
Configuration class:
// config/packages/aequation_wire.yaml
imports:
- { resource: '@AequationWireBundle/Resources/config/config.yaml' }
aequation_wire:
custom_option: 'value' # New key
Configuration class in a custom bundle to include custom_option.Twig Globals:
TwigExtension:
// src/Twig/AppExtension.php
class AppExtension extends \Aequation\WireBundle\Twig\BaseExtension {
public function getGlobals(): array {
return [
'app_custom_var' => 'value',
];
}
}
Caching:
php bin/console cache:clear
cache:pool:clear to avoid full cache rebuilds.Lazy Loading:
How can I help you explore Laravel packages today?