sunlight-cms / console
Sunlight CMS command-line utilities
Requires
- php: >=7.1
- composer/semver: ^3.3.2
- kuria/debug: ^4.0.1
- kuria/options: ^2.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.26
- sunlight-cms/sunlight-cms: dev-master
- vimeo/psalm: ^5.15
This package is auto-updated.
Last update: 2024-11-30 02:19:01 UTC
README
This library provides various CLI commands to help develop and maintain a SunLight CMS project.
Contents
Installation
The SunLight CMS skeleton provides this console already pre-configured.
If you want to add this console into a project not based on the skeleton, you can do so using Composer:
composer require sunlight-cms/console
Configuration
The console will read configuration from your project's composer.json file.
{ // ... "extra": { "sunlight-console": { "cms": { "version": "latest" } } } }
Supported options
cms
Options related to how the CMS files are downloaded.
version
Required
CMS version to download.
If zip-url
is set in cms.archive, the CMS will be downloaded
from the specified URL. In that case the version string can have any format.
If cms.archive is configured to use a git repository, the version string can have these formats:
latest
- will download the latest supported version (and also updatecms.version
to that version)8.0.0
- will download the exact tagged version~8.0.0
- will find and download a tagged version matching the constraintdev-master
- will download the latest version of the specified branch
archive
Default: configured to use https://github.com/sunlight-cms/sunlight-cms
"archive": { "zip-url": null, "zip-paths-prefix": "sunlight-cms-%version%/", "git-url": "https://github.com/sunlight-cms/sunlight-cms.git", "git-branch-zip-url": "https://github.com/sunlight-cms/sunlight-cms/archive/refs/heads/%version%.zip", "git-tag-zip-url": "https://github.com/sunlight-cms/sunlight-cms/archive/refs/tags/v%version%.zip", "git-tag-pattern": "v8*" }
zip-url
- CMS archive download URL ornull
to use a git repositoryzip-paths-prefix
- prefix of the paths in the archive (can be empty)git-url
- git repository URL to scan for tags ornull
git-branch-zip-url
- URL that serves a branch as a .zip file ornull
git-tag-zip-url
- URL that serves a tag as a .zip file ornull
git-tag-pattern
- pattern for tag matching (used in git ls-remote) ornull
Note
zip-paths-prefix
, git-branch-zip-url
and git-tag-zip-url
may contain
a %version%
placeholder which will be replaced by the specified cms.version
plugins
Default: no plugins
List of plugins to extract from the CMS archive. Templates will not be overwritten.
"plugins": { "extend": [ "devkit", "codemirror", "lightbox" ], "templates": [ "default", "blank" ], "languages": [ "cs", "en" ] }
installer
Default: true
Boolean value indicating whether to extract the install/ directory from the CMS archive.
Note
The installer will only be extracted if the CMS files don't already exist.
commands
Default: []
Map of custom commands to add to the console.
Example:
"commands": { "example.foo": { "class": "Example\\FooCommand" }, "example.bar": { "class": "Example\\BarCommand" } }
The command classes must extend SunlightConsole\Command
.
Note
See src/Config/ServiceConfig.php for a full list of supported options.
Commands from other packages
Other installed Composer packages can define commands the same way in their composer.json.
In this case, only the commands
option will be read and all others
will be ignored.
The package can have any type other than "project".
is-fresh-project
Default: false
Boolean value indicating that this is a fresh project.
If set to true
, the next time the CMS files are downloaded some additional
updates will be made to composer.json:
- name, description and license will be unset
- the
is-fresh-project
option will be unset - if a semver version constraint (or "latest") has been used to locate the CMS archive, the cms.version will be automatically changed to the installed version number
Usage
bin/console <command> [options] [args]
Commands
The console provides the following commands by default:
(Run bin/console
or bin/console help
to show more information
about the available commands.)
backup.create create a backup cache.clear clear the cache cms.download download CMS files cms.info show information about the CMS cms.patch apply a patch to CMS files in the project config.create create config.php with default contents config.dump dump config.php contents config.set modify an option in config.php db.dump dump database db.import import a SQL dump db.query execute a SQL query log.monitor continuously print out log entries log.search search log entries plugin.action perform a plugin action (or list actions if no action is given) plugin.install install plugin from a ZIP file or an URL plugin.list list all plugins plugin.show show information about a plugin project.dump-config dump resolved project configuration user.reset-password reset password for the given user help show help
Tip
You can also pass --help
to any command to show help for it.
Command name matching
It is possible to pass partial command names if it is not ambiguous.
For example:
bin/console ca.cl
will run thecache.clear
commandbin/console pl.s devkit
will run theplugin.show
command