aequation/labo
Symfony install bundle by Aequation (aequation/labo). Provides installation/setup helpers and bundle scaffolding to streamline configuring a Symfony app and its dependencies during initial project setup.
Installation
composer require aequation/labo
Add the bundle to config/bundles.php:
Aequation\LaboBundle\LaboBundle::class => ['all' => true],
First Use Case Run the default configuration command to generate a basic project structure:
php bin/console labo:install
This creates:
AppBundle (or custom bundle) with common traitsAppKernel with preconfigured servicesconfig/packages/ structureWhere to Look First
config/labo.yaml (main configuration)src/AppBundle/ (generated base bundle)src/AppBundle/Traits/ (reusable traits)src/AppBundle/DependencyInjection/ (custom DI extensions)Bundle Generation Extend the base bundle with custom commands:
php bin/console make:labo-bundle MyCustomBundle
Resources/config/services.yamlDependencyInjection/ with extension classesTraits/ for reusable logicService Configuration
Use labo.yaml to define shared services:
services:
my_service:
class: App\Service\MyService
arguments:
- '@doctrine.orm.entity_manager'
Access via Symfony’s container:
$this->get('my_service');
Trait Integration Reuse common logic across controllers/services:
use AppBundle\Traits\ApiResponseTrait;
class MyController extends AbstractController {
use ApiResponseTrait;
public function index() {
return $this->jsonResponse(['data' => 'test']);
}
}
Command-Line Automation
Extend the LaboCommand base class for custom tasks:
namespace App\Command;
use Aequation\LaboBundle\Command\LaboCommand;
class MyCustomCommand extends LaboCommand {
protected function configure() {
$this->setName('app:custom-task');
}
protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('Running custom task!');
}
}
Namespace Conflicts
AppBundle by default. Rename it if using Symfony Flex autoloader:
php bin/console make:labo-bundle MyVendor/MyBundle
autoload in composer.json includes the new namespace.Overwriting Config
labo:install overwrites config/packages/ files. Backup or use --dry-run first:
php bin/console labo:install --dry-run
Trait Autoloading
src/AppBundle/Traits/ or Symfony’s autoloader will fail. Use:
# config/autoload.php
$loader->registerPrefixes([
AppBundle::DIR.'/Traits' => 'App\\Bundle\\Traits',
]);
Dependency Injection Quirks
labo.yaml won’t override existing DI definitions. Use config/packages/ for priority:
# config/packages/my_service.yaml
services:
my_service:
class: App\Service\MyService
tags: ['my.tag']
Customize the Installer
Override the installer class in labo.yaml:
installer_class: App\Installer\CustomInstaller
Extend Aequation\LaboBundle\Installer\Installer to add/skip steps.
Debugging Commands
Use --verbose for detailed output:
php bin/console labo:install --verbose
Symfony 6+ Compatibility
The bundle lacks Symfony 6’s autowiring support. Manually enable in config/services.yaml:
parameters:
container.autowiring.strict_mode: true
Extending the Base Bundle
Add your own traits/commands to AppBundle and reference them in Resources/config/services.yaml:
services:
_defaults:
autowire: true
autoconfigure: true
App\Traits\MyTrait: ~
How can I help you explore Laravel packages today?