php:script¶
Run php a script after a full Drupal bootstrap.
A useful alternative to eval command when your php is lengthy or you can't be bothered to figure out bash quoting. If you plan to share a script with others, consider making a full Drush command instead, since that's more self-documenting. Drush provides commandline options to the script via a variable called $extra.
Help topics:
Examples¶
php:script example --script-path=/path/to/scripts:/another/pathphp:script -php:script foo -- apple --cider
Arguments¶
- [extra].... Script name and arguments. First argument is script name, remaining are passed to the script.
Options¶
- --script-path=SCRIPT-PATH. Additional paths to search for scripts, separated by : (Unix-based systems) or ; (Windows).
- --format=FORMAT. Format the result data. Available formats: csv,json,list,null,php,print-r,sections,string,table,tsv,var_dump,var_export,xml,yaml [default: var_dump]
Global Options¶
- -v|vv|vvv, --verbose. Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
- -y, --yes. Auto-accept the default for all user prompts. Equivalent to --no-interaction.
- -l, --uri=URI. A base URL for building links and selecting a multi-site. Defaults to https://default.
- To see all global options, run
drush core:global-options.
Aliases¶
- scr
- php-script
Legend
- An argument or option with square brackets is optional.
- Any default value is listed at end of arg/option description.
- An ellipsis indicates that an argument accepts multiple values separated by a space.