brix/core-bundle
CoreBundle is the foundation bundle for BrixCMS, providing the core services and infrastructure used by the CMS and related bundles.
Installation Add the package via Composer:
composer require alexandrekilian/core-bundle
Register the bundle in config/bundles.php:
return [
// ...
AlexandreKilian\CoreBundle\CoreBundle::class => ['all' => true],
];
First Use Case Publish the default configuration:
php artisan vendor:publish --tag=core-bundle-config
Verify the config file is generated at config/core.php.
Basic Usage Access core services via Laravel's container:
$coreService = app('core.service');
Service Integration Inject the core service into controllers or commands:
use AlexandreKilian\CoreBundle\Service\CoreService;
class MyController extends Controller
{
public function __construct(private CoreService $coreService) {}
}
Event Handling Listen to core events (if documented):
event(new \AlexandreKilian\CoreBundle\Event\CoreEvent());
Configuration Overrides Extend the published config:
'core' => [
'my_custom_setting' => env('CUSTOM_VALUE', 'default'),
],
Lack of Documentation
src/Service/ and src/Event/ for undocumented features.Configuration Quirks
vendor:publish tag (core-bundle-config) may not exist. Verify with:
php artisan vendor:publish --tag=core-bundle-config --dry-run
config/core.php with default values.Namespace Conflicts
AlexandreKilian\CoreBundle. Ensure no naming collisions with other packages.app()->has('core.service') to check if the service is registered.EventDispatcher listeners:
$dispatcher->addListener(\AlexandreKilian\CoreBundle\Event\CoreEvent::class, function ($event) {
\Log::debug('Core event triggered:', $event->toArray());
});
Custom Services Bind extensions to the container:
$this->app->bind('core.extension', function () {
return new MyCoreExtension();
});
Middleware Integration
If the bundle provides middleware (e.g., CoreMiddleware), register it in app/Http/Kernel.php:
protected $middleware = [
// ...
\AlexandreKilian\CoreBundle\Http\Middleware\CoreMiddleware::class,
];
Event Subscribers
Subscribe to core events (if available) in EventServiceProvider:
protected $listen = [
\AlexandreKilian\CoreBundle\Event\CoreEvent::class => [
MyCoreEventHandler::class,
],
];
How can I help you explore Laravel packages today?