Installation
composer require dzignphp/core-bundle
Add to config/app.php under extra.bundles:
Dzignphp\CoreBundle\DzignphpCoreBundle::class => ['all' => true],
First Use Case
Dzignphp\CoreBundle\Service\BaseService) as a foundation for your own services.config/packages/dzignphp_core.yaml for default settings (if provided) and override in your project’s config.Where to Look First
src/Service/ for reusable logic (e.g., logging, validation, or utility helpers).src/Traits/ for shared behavior (e.g., HasLoggerTrait).src/Command/ for CLI tools (if available).tests/ for usage examples and edge cases.Extending Base Services
BaseService to leverage built-in methods like log(), validate(), or handleException().use Dzignphp\CoreBundle\Service\BaseService;
class MyCustomService extends BaseService {
public function doSomething() {
$this->log('Action triggered');
// Custom logic here
}
}
Configuration-Driven Features
dzignphp_core.enabled_features) to toggle bundle features dynamically.config/packages/dzignphp_core.yaml:
dzignphp_core:
enabled_features: [logging, validation]
Event Listeners/Subscribers
EventDispatcher.use Dzignphp\CoreBundle\Event\MyEvent;
class MyListener implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
MyEvent::class => 'onMyEvent',
];
}
public function onMyEvent(MyEvent $event) { ... }
}
CLI Integration
src/Command/ and bind them to the container.namespace App\Command;
use Dzignphp\CoreBundle\Command\BaseCommand;
class MyCommand extends BaseCommand {
protected function configure() {
$this->setName('app:my-command');
}
protected function execute(InputInterface $input, OutputInterface $output) {
$this->log('Command executed');
}
}
HasLoggerTrait).config/services.yaml:
services:
Dzignphp\CoreBundle\Service\BaseService: '@app.custom_base_service'
kernel.php:
$kernel->pushMiddleware(new \Dzignphp\CoreBundle\HttpMiddleware\MyMiddleware());
Undocumented Features
BaseService might have hidden debug() or cache() methods not mentioned in the README.Configuration Overrides
dzignphp_core.yaml is missing, the bundle may use hardcoded defaults. Always check for config files in:
config/packages/dzignphp_core.yamlconfig/dzignphp_core.yaml (fallback).Namespace Collisions
Dzignphp (with a "z"), not Design or similar. Double-check imports to avoid ClassNotFound errors.Event System Assumptions
KernelEvents::REQUEST), ensure your listeners are registered after the bundle’s subscribers.Performance Overhead
HasLoggerTrait may add logging to every method call. Disable via config if unused:
dzignphp_core:
logging:
enabled: false
APP_DEBUG=true in .env to see detailed logs from BaseService::log().php bin/console debug:container Dzignphp\CoreBundle
php bin/console debug:event-dispatcher
Custom Traits
HasLoggerTrait) by creating your own:
trait MyCustomLoggerTrait {
use HasLoggerTrait {
HasLoggerTrait::log as private parentLog;
}
public function log(string $message) {
$this->parentLog("[CUSTOM] {$message}");
}
}
Service Decorators
BaseService to modify behavior:
services:
app.base_service.decorated:
decorates: 'dzignphp_core.base_service'
arguments: ['@app.base_service.decorated.inner']
Command Extensions
Command/ directory with higher priority.Compiler Passes
use Dzignphp\CoreBundle\DependencyInjection\Compiler\MyPass;
class MyCustomPass extends MyPass {
public function process(ContainerBuilder $container) {
// Extend logic here
}
}
Register it in services.yaml:
services:
app.my_custom_pass:
tags: [compiler]
arguments: ['@service_container']
How can I help you explore Laravel packages today?