Since this is a Symfony bundle, Laravel developers will need to use Symfony’s Laravel Bridge (symfony/ux-live-component + symfony/ux-turbo) or a standalone Symfony microkernel for seamless integration. Start here:
Install Symfony Bridge (Recommended)
composer require symfony/ux-live-component symfony/ux-turbo
Configure Live Components in resources/views/layouts/app.blade.php:
<html data-turbo="true">
<body>
{{ $slot }}
@livewireScripts
@symfonyUxScripts
</body>
</html>
Install the Bundle via Composer
composer require brangerieau/symfonycms
Create a Symfony Kernel (Optional but Recommended)
Use symfony/var-dumper and symfony/http-kernel to embed Symfony routes in Laravel:
// app/Providers/SymfonyKernelServiceProvider.php
use Symfony\Component\HttpKernel\KernelInterface;
use Brangerieau\SymfonyCmsBundle\SymfonyCmsBundle;
class SymfonyKernelServiceProvider extends ServiceProvider
{
public function register()
{
$kernel = new class extends \Symfony\Component\HttpKernel\Kernel {
public function registerBundles(): array
{
return [
new SymfonyCmsBundle(),
];
}
};
$this->app->singleton(KernelInterface::class, fn() => $kernel);
}
}
Route the Admin Panel
Add Symfony routes to Laravel’s routes/web.php:
Route::prefix('admin')->group(function () {
Route::get('/{path}', function () {
$kernel = app(KernelInterface::class);
return $kernel->handle(
Request::create('/admin/' . $path, 'GET')
);
});
});
Install Assets
php artisan symfony:assets:install # Hypothetical; check bundle docs
npm run dev # If using Webpack Encore
config/packages/symfony_cms.yaml:
brangerieau_symfony_cms:
content_types:
blog_post:
fields:
- { name: 'title', type: 'text' }
- { name: 'body', type: 'html' }
/admin/content/blog_post. Use it to:
ROLE_CMS_EDITOR) via Symfony’s security system.Laravel as API + Symfony as CMS
$response = Http::withOptions(['verify' => false])->get('http://symfony-cms/admin/api/content');
Livewire + Symfony CMS Integration
// app/Http/Livewire/CmsContentManager.php
public function getContent($type)
{
return Http::get("/admin/api/content/{$type}")->json();
}
Twig Templates in Laravel (Advanced)
twig/extra-bundle:
$loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/resources/views');
$twig = new \Twig\Environment($loader);
echo $twig->render('cms_template.html.twig', ['content' => $data]);
UserProvider:
// config/packages/security.yaml (Symfony side)
providers:
laravel_users:
entity: { class: App\Models\User, property: email }
doctrine/dbal.webpack.config.js to match Laravel’s setup.Symfony vs. Laravel Routing Conflicts
Route::prefix('admin') to isolate Symfony routes.php artisan route:clear) after changes.Asset Pipeline Mismatch
config/packages/webpack_encore.yaml and use Laravel Mix instead.Doctrine ORM vs. Eloquent
Security Misconfigurations
security.yaml is not auto-loaded in Laravel.# config/auth.php (Laravel)
'providers' => [
'symfony' => [
'driver' => 'symfony',
'model' => Brangerieau\SymfonyCmsBundle\Entity\User::class,
],
],
dd(app(KernelInterface::class)->getEnvironment());
php artisan symfony:debug:routes # Hypothetical; use Symfony’s `debug:router` instead
config/packages/doctrine.yaml:
doctrine:
dbal:
profiling: '%kernel.debug%'
Custom Content Types Extend the bundle’s content type system by creating a custom field type:
// src/FieldType/CustomFieldType.php
namespace App\FieldType;
use Brangerieau\SymfonyCmsBundle\Form\FieldType\AbstractFieldType;
class CustomFieldType extends AbstractFieldType
{
public function getType(): string { return 'custom'; }
public function buildForm(FormBuilderInterface $builder, array $options) { /* ... */ }
}
Register in config/packages/symfony_cms.yaml:
brangerieau_symfony_cms:
field_types:
custom: App\FieldType\CustomFieldType
Event Listeners
Hook into SymfonyCMS events (e.g., content.pre_save):
// src/EventListener/CmsListener.php
namespace App\EventListener;
use Brangerieau\SymfonyCmsBundle\Event\ContentEvent;
class CmsListener
{
public function onContentSave(ContentEvent $event)
{
$content = $event->getContent();
// Modify content before save
}
}
Register in config/services.yaml:
services:
App\EventListener\CmsListener:
tags:
- { name: 'kernel.event_listener', event: 'content.pre_save' }
Override Twig Templates
Copy SymfonyCMS templates from vendor/brangerieau/symfonycms/src/Resources/views to resources/views/symfony_cms to override them.
php artisan cache:clear # Laravel
php bin/console cache:clear # Symfony (if embedded)
cms_content table for large datasets:
CREATE INDEX idx_content_type ON cms_content(type);
How can I help you explore Laravel packages today?