symfony-cmf/simple-cms-bundle
Symfony CMF Simple CMS Bundle maps content, routes, and menu items from a single tree in a content repository, prioritizing simplicity over flexibility. Part of Symfony CMF. Unmaintained; only security and bugfix releases expected.
Installation
Add the bundle to your composer.json:
composer require symfony-cmf/simple-cms-bundle
Register it in config/bundles.php:
return [
// ...
SymfonyCmf\SimpleCmsBundle\SimpleCmsBundle::class => ['all' => true],
];
Database Setup Run migrations (if provided in the bundle or create your own):
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
Basic Configuration
Update config/packages/simple_cms.yaml (if it exists) or create it:
simple_cms:
routes:
enabled: true
content:
enabled: true
First Use Case Create a simple route-based page:
php bin/console simple-cms:create-route --name="homepage" --path="/"
Then create a controller to handle it (if not auto-generated).
Route-Based CMS
php bin/console simple-cms:create-route --name="about" --path="/about"
# config/routes/simple_cms.yaml
simple_cms_route:
resource: "@SimpleCmsBundle/Resources/config/routing.yml"
prefix: /
Content Management
SimpleCmsBundle\Model\Content):
namespace App\Entity;
use SymfonyCmf\SimpleCmsBundle\Model\Content as BaseContent;
class Page extends BaseContent {
// Custom fields
}
ContentRepository to fetch/publish content:
$content = $this->getDoctrine()->getRepository(Page::class)->findOneBy(['route' => '/']);
Twig Integration
{% set content = app.simple_cms.content_manager.getContent('/') %}
{{ content.title }}
templates/SimpleCmsBundle/ (e.g., default.html.twig).Versioning & Publishing
ContentManager to publish drafts:
$content->setPublished(true);
$contentManager->publish($content);
config/bundles.php.Content, Route).simple_cms.content.pre_publish or simple_cms.route.create for custom logic.Unmaintained Status
Route Conflicts
simple_cms_route:
resource: "@SimpleCmsBundle/Resources/config/routing.yml"
prefix: /cms
Doctrine Migrations
php bin/console make:migration
Caching Quirks
php bin/console cache:clear
SimpleCmsBundle\Twig\Extension\ContentExtension to customize caching behavior.php bin/console debug:router to inspect registered routes.dump($content->getRoute()->getPath());
$eventDispatcher->addListener('simple_cms.content.pre_publish', function ($event) {
error_log('Publishing: ' . $event->getContent()->getRoute());
});
Custom Content Types
Extend BaseContent and register the entity in config/doctrine.yaml:
App\Entity\Page:
type: entity
repositoryClass: App\Repository\PageRepository
Route Providers
Implement SymfonyCmf\SimpleCmsBundle\Provider\RouteProviderInterface for dynamic routes.
Twig Extensions
Override the ContentExtension to add custom filters/functions:
class CustomContentExtension extends \SymfonyCmf\SimpleCmsBundle\Twig\Extension\ContentExtension {
public function getMarkup($content) {
return "Custom: " . $content->getTitle();
}
}
Register it in services.yaml:
app.twig.extension.content:
class: App\Twig\Extension\CustomContentExtension
tags: ['twig.extension']
CLI Commands
Extend SimpleCmsBundle\Command\AbstractCommand to add custom commands.
How can I help you explore Laravel packages today?