Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Page Bundle

Page Bundle Laravel Package

sonata-project/page-bundle

SonataPageBundle adds site and page management to Symfony apps, using a container-based page system and block services. Build and manage pages across multiple sites, integrate with Sonata blocks, and control layout, routing, and page publishing.

View on GitHub
Deep Wiki
Context7

This bundle provides a Site and Page management through container and block services

Frequently asked questions about Page Bundle
Can SonataPageBundle work with Laravel 9/10 without Symfony dependencies?
Yes, but with adjustments. SonataPageBundle is Symfony-first, but you can replace Symfony’s DI with Laravel’s service container, use Eloquent instead of Doctrine, and bridge Twig with Blade via `twig/bridge`. The core page/block logic remains functional, though some Symfony-specific features (like AdminBundle) require extra work.
How do I migrate existing WordPress content into SonataPageBundle?
Sonata doesn’t provide direct WordPress importers, but you can use custom scripts to parse WordPress exports (XML/WXR) and map them to Sonata’s `Page`, `Block`, and `Site` entities. The bundle’s documentation includes migration examples for other CMS platforms—adapt those for WordPress. For large sites, test with a subset first.
Will SonataPageBundle conflict with Laravel’s route caching?
Yes, conflicts can occur because Sonata dynamically generates routes. Mitigate this by disabling Laravel’s route caching (`php artisan route:clear`) or using middleware to rewrite routes on-the-fly. For production, consider isolating Sonata routes under a subdomain or namespace, then merge them via a custom route service provider.
Can I use SonataPageBundle with Laravel’s Filament or Nova instead of SonataAdminBundle?
Absolutely. SonataAdminBundle is optional—you can replace it entirely with Filament or Nova by creating custom resources for `Page`, `Block`, and `Site` models. This reduces Symfony dependency and integrates better with Laravel’s admin ecosystem. The bundle’s core functionality (page rendering, blocks) remains unchanged.
How do I integrate Twig templates with Laravel’s Blade?
Install the `twig/bridge` package to embed Twig in Blade templates, or write custom Blade directives to wrap Twig logic. For example, `@twig('{{ include('partials/block.twig') }}')`. This adds minimal overhead but ensures Sonata’s Twig-based blocks render correctly. Avoid mixing Twig and Blade in the same template for clarity.
Does SonataPageBundle support multi-tenancy for sites?
Yes, the bundle natively supports multi-site management via the `Site` entity, which acts as a container for pages and blocks. Each site can have its own routing, templates, and content. Use Laravel’s database connections or Eloquent’s global scopes to isolate tenant data if needed.
What’s the best way to test SonataPageBundle in Laravel?
Test page rendering, blocks, and routing with Laravel’s HTTP tests. Mock Sonata’s services (e.g., `PageManager`) in unit tests using Laravel’s service container bindings. For integration tests, use `actingAs()` to simulate authenticated users and verify block rendering. The bundle’s Symfony-based tests can serve as a reference for structure.
Are there alternatives to SonataPageBundle for Laravel?
Yes. For lightweight solutions, consider `spatie/laravel-medialibrary` (media management) + custom page models. For full CMS features, evaluate `orchid/software` (Laravel-native) or `cms-craft/cms` (headless-friendly). Sonata excels in structured, block-based sites but requires more effort to adapt to Laravel than native packages.
How do I handle caching for dynamic pages in production?
Sonata uses Symfony’s cache, but you can replace it with Laravel’s cache system (Redis/Memcached) via adapters. Cache page fragments (blocks) separately to avoid full-page regeneration. Use Laravel’s `Cache::remember()` for dynamic content and set TTLs based on update frequency. Avoid caching unpublished or draft pages.
What Laravel versions and PHP requirements does SonataPageBundle support?
SonataPageBundle’s latest branches (4.x/5.x) target PHP 8.1+ and Symfony 6/7, which aligns with Laravel 9/10. While not officially Laravel-compatible, the core logic works with modern Laravel if you replace Symfony dependencies (DI, Doctrine) with Laravel equivalents. Test thoroughly on your PHP/Laravel version.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor