Installation:
composer require alterphp/developer-bundle
Add to config/bundles.php (Symfony 3.x+):
return [
// ...
Alterphp\DeveloperBundle\AlterphpDeveloperBundle::class => ['all' => true],
];
First Use Case:
nelmio/alice for quick fixture generation.
# config/packages/nelmio_alice.yaml
nelmio_alice:
fixtures:
- %kernel.project_dir%/tests/fixtures/alice.yaml
doctrine-fixtures-bundle for bulk data seeding.Key Features to Explore:
alterphp/components: Check for utility classes (e.g., debug helpers).Fixture-Based Testing:
tests/fixtures/alice.yaml:
App\Entity\User:
user{1..10}:
email: <email()>
roles: ['ROLE_USER']
use Nelmio\Alice\Loader\NativeLoader;
$loader = new NativeLoader();
$objects = $loader->load(__DIR__.'/fixtures/alice.yaml');
Debugging Utilities:
alterphp/components for custom debug tools (e.g., dumping complex objects):
use Alterphp\Components\Debug\Dumper;
Dumper::dump($entity); // Enhanced var_dump
Symfony Console Commands:
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class CustomCommand extends Command {
protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('DeveloperBundle integrated!');
}
}
doctrine:fixtures:load.Symfony Version Lock:
composer require symfony/symfony:^3.0 if migrating from Symfony 2.Fixtures Overhead:
--env=test and --no-debug flags:
php bin/console doctrine:fixtures:load --env=test --no-debug
Undocumented Components:
alterphp/components may lack docs. Inspect the source for undocumented helpers.# config/packages/dev/debug.yaml
framework:
debug: true
php bin/console doctrine:fixtures:load -v
Custom Fixture Loaders:
Override Nelmio\Alice\Loader\LoaderInterface for custom logic:
namespace App\Loader;
use Nelmio\Alice\Loader\LoaderInterface;
class CustomLoader implements LoaderInterface {
public function load($file, array $parameters = []) {
// Custom logic
}
}
Post-Install Checks:
alterphp/components is auto-loaded (check composer.json).# tests/fixtures/minimal.yaml
App\Entity\TestEntity: ~
Performance:
# config/packages/prod/nelmio_alice.yaml
nelmio_alice:
enabled: false
How can I help you explore Laravel packages today?