Console
yf has a command line tool on Symfony Console: php vendor/bin/yf in a project that installs yf with composer, or
php bin/yf in a checkout of yf. Run it from the project folder (or any folder below it): it finds the project by its
config/ folder. list shows the commands this project has, help <command> the options of one.
cd /path/to/site
php vendor/bin/yf list
php vendor/bin/yf help tpl:check
php vendor/bin/yf tpl:check --json
Commands come from console/commands/ of the framework and the commands/ folder of each plugin
(yf_console_<name>.class.php), then from the app and the project (commands/console_<name>.class.php
and the plugins of both). The first one found wins, so a project replaces a framework command by writing one with the same file name.
A command is a Symfony Command class; yf_console_boot_project($output) starts the framework when it needs
db(), _class() and the rest. Most commands that write ask for --yes after showing what they would do,
and most have --json for scripts.
Development
| Command | What it does |
|---|---|
serve | Runs the sample app with the PHP built-in web server (--host, --port, default 127.0.0.1:33380; needs MariaDB). |
make:module <name> | Scaffolds a user module (modules/yf_<name>.class.php); --plugin puts it in plugins/<plugin>/, --base in another folder, --dry-run prints it. |
make:admin <name> | Scaffolds an admin module (admin_modules/yf_<name>.class.php), with the same options. A new admin module needs a guide too: a row of the admin pages docs or its own page. |
make:model <name> | Scaffolds a model (models/<name>_model.class.php); --table names its table. |
make:plugin <name> | Scaffolds the folders of a plugin (plugins/<name>/). |
tpl:check | Checks every .stpl template: block tags pair, comments close, the compiled form is valid PHP. --framework, --warnings, --json, --twig (the .twig files too, with Twig's parser); a .stpl file a twig: caller renders is checked with Twig's parser (--no-twig-callers: the stpl rules for every .stpl file); exit 1 on an error, for CI. See the template manager. |
tests:unit | Runs the framework unit tests (a checkout of yf); --quiet-output prints the summary and the failures. |
langs:export | Writes the translations of each language, as the locale editor collects them, to langs_exported_<lang>.csv in the current folder. |
assets:outdated | Assets behind their latest version with the upgrade advice; --all, --json, --refresh asks npm (network). |
demo:basic <name> | Example of a command with an argument and an option (--yell): copy one of the demo commands to start your own. |
demo:progress | Example of a progress bar. |
demo:table | Example of the table helper. |