sy / bootstrap-cms
Plugin for adding CMS feature
Requires
- php: >=8.1
- ext-dom: *
- ext-json: *
- masterminds/html5: ^2.8
- scssphp/scssphp: *
- sy/bootstrap: ^2.0 || ^3.0
- sy/bootstrap-wysiwyg: ^1.11
- sy/webcomponent: ^2
Requires (Dev)
- phpunit/phpunit: ^13
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 1.27.6
- 1.27.5
- 1.27.4
- 1.27.3
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.2
- 1.26.1
- 1.26.0
- 1.25.3
- 1.25.2
- 1.25.1
- 1.25.0
- 1.24.1
- 1.24.0
- 1.23.1
- 1.23.0
- 1.22.4
- 1.22.3
- 1.22.2
- 1.22.1
- 1.22.0
- 1.21.0
- 1.20.3
- 1.20.2
- 1.20.1
- 1.20.0
- 1.19.1
- 1.19.0
- 1.18.8
- 1.18.7
- 1.18.6
- 1.18.5
- 1.18.4
- 1.18.3
- 1.18.2
- 1.18.1
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.5
- 1.13.4
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.10
- 1.12.9
- 1.12.8
- 1.12.7
- 1.12.6
- 1.12.5
- 1.12.4
- 1.12.3
- 1.12.2
- 1.12.1
- 1.12.0
- 1.11.4
- 1.11.3
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.1
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.1
- 1.6.0
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.8.1
- 0.8.0
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.2
- 0.1.1
- 0.1.0
- dev-develop
This package is auto-updated.
Last update: 2026-11-30 08:33:34 UTC
README
sy/bootstrap plugin for adding "CMS" feature in your sy/project based application.
Installation
From your sy/project application directory:
composer require sy/bootstrap-cms
The project's post-update-cmd hook then runs @sy install
(sy/project 8.0.0, sy/bootstrap ≥ 2.2):
templates/— missing files only, so a template the project has edited is never overwritten;flyway repairthenmigrate— on the core schema and on the plugin schema (flyway_cms_history), straight from the package'ssql/directory.
The package ships no assets and no stylesheet, and its translations are loaded from its
own directory: nothing is copied into assets/, protected/scss or protected/lang.
composer install-plugin no longer exists (sy/project 8.0.0). On a project older than
that, run composer sy install after the composer require.
Page methods
Create a method in your Project\Application\Page class (in protected/src/Application/Page.php):
/** * Content page */ public function contentAction() { $this->setContentVars([ 'CONTENT' => new \Sy\Bootstrap\Component\Cms\Content($this->get('id', 1)), ]); }
Optionally, override the home page with the content page
/** * Home page */ public function homeAction() { $this->copy('content'); }
Add URL converter in Application.php
In protected/src/Application.php
<?php namespace Project; use Sy\Bootstrap\Lib\Url; class Application extends \Sy\Bootstrap\Application { protected function initUrlConverter() { Url\AliasManager::setAliasFile(__DIR__ . '/../conf/alias.php'); Url::addConverter(new Url\AliasConverter()); Url::addConverter(new Url\ContentConverter()); // Add the content URL converter Url::addConverter(new Url\ControllerActionConverter()); } }
Converters are evaluated in registration order. ContentConverter uses an empty prefix by default, so it checks every root-level path against the content aliases: it must be registered after more specific converters and before ControllerActionConverter, which is the terminal fallback. A content is then reachable as /<alias> or /<lang>/<alias> and is mapped to p=page, a=content, id=<id>.
See the URL Converters wiki page for the full converter contract, ordering rules and Url::build() examples.
Add the content pages sitemap in Sitemap.php
In protected/src/Application/Sitemap.php
<?php namespace Project\Application; class Sitemap extends \Sy\Bootstrap\Application\Sitemap { public function __construct() { parent::__construct(); $this->addProvider(new \Sy\Bootstrap\Application\Sitemap\Page()); $this->addProvider(new \Sy\Bootstrap\Application\Sitemap\Content()); // Add the content sitemap } }
Content adds one entry to the sitemap index (<project>/sitemap/content) and lists every content whose visibility is public: <lastmod> is its updated_at date, and every language declared in LANGS gets its own URL plus an <alternate> set. With a single language in LANGS, the URL keeps lang=none.
The provider must be registered: Sitemap resolves the requested action to Project\Application\Sitemap\<Action> then Sy\Bootstrap\Application\Sitemap\<Action>, and answers 404 when no provider class matches the action or when that class was never added with addProvider(). An unregistered Content sitemap is therefore a 404, not an empty file; leaving it out of Sitemap.php also keeps the content URLs out of the sitemap index.