Download the PHP package craft-cli/cli without Composer
On this page you can find all versions of the php package craft-cli/cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download craft-cli/cli
More information about craft-cli/cli
Files in craft-cli/cli
Informations about the package cli
Craft CLI
Command line interface for Craft CMS.
Installation
If you are on Mac, you should install via Homebrew.
Otherwise, you should download the phar: https://github.com/rsanchez/craft-cli/releases/latest
See Composer Installation for alternate ways to install.
Usage
If you are using a multi-environment config, you must specify your environment either using the --environment=
flag on your commands, or set the CRAFT_ENVIRONMENT
env variable.
Craft CLI is dotenv aware, and will automagically load environment variables from a .env
file in your project root (path can be customised via .craft-cli.php
). You may set your Craft environment by setting a CRAFT_ENVIRONMENT
variable in your .env
file.
Commands
assets:pull
assets:push
clear:cache
console
db:backup
db:create
db:pull
db:push
db:restore
download
generate:command
help
init
install
install:plugin
list
rebuild:searchindexes
run:tasks
show:config
tail
update:assetsindexes
Assets Pull
Pull Asset files from a remote environment.
Assets Push
Push Asset files to a remote environment
Clear Cache
Clear all Craft caches.
Select which cache(s) to clear from an interactive list.
Console
Start an interactive shell.
DB Backup
Backup your database to craft/storage/backups
.
Backup your database to the specified path.
DB Create
Create a database
DB Pull
Pull a remote database to the local database.
DB Push
Push your local database to a remote database.
DB Restore
Restore the database from the most recent backup from craft/storage/backups
.
Restore the database from the specified .sql
file.
Download Craft
Download Craft to the current directory.
Create the specified directory and download Craft into it.
Generate Command
Generate a custom command file in the specified directory.
Generate a custom command file with a namespace.
Generate a custom command with arguments and options.
Help
Display information about a command and its arguments/options.
Init
Create an .craft-cli.php
config file in the current directory
This config file is only necessary if you if you are using Custom Commands or have renamed your craft
folder.
Install Craft
Download and install Craft to the current directory.
Create the specified directory and install Craft into it.
Install Plugin
Install a plugin from a GitHub repository.
List
List the available commands.
Rebuild Search Indexes
Run Tasks
Run all pending tasks.
Reset "running" (stalled) tasks and then run all tasks.
Reset failed tasks and then run all tasks.
Show Config
Show all config items.
Show the specified config item.
Tail
Show a tail of craft.log
Update Asset Indexes
Configuration
Craft CLI can be configured in two ways. You may use the craft init
command to generate a .craft-cli.php
file. Or, if you have installed Craft CLI via composer, you may add an extra
object to your composer.json
and a craft-cli
object within the extra
object:
Custom Commands
Craft CLI custom commands are Symfony Console Command objects. You can add custom commands to your .craft-cli.php
or composer.json
config by adding a namespace and folder path to the commandDirs
object.
You can generate a custom command file using the craft generate:command
command.
Troubleshooting
Your command-line PHP cannot connect to MySQL
You can test this by running this at the command line (change the DB credentials to your actual credentials):
If this prints false, then you know that your CLI PHP is not configured to connect to your database. This is frequently caused by an incorrect default MySQL socket setting.
If you are running MAMP, for instance, and are using the stock Mac OS command-line PHP, you will not be able to connect out-of-the-box. You will need to edit your /etc/php.ini
(or wherever your php.ini file is located) file and change the mysql.default_socket
and/or the mysqli.default_socket
to /Applications/MAMP/tmp/mysql/mysql.sock
.
Composer Installation
You can install globally:
Make sure your global composer installation is added to your PATH in your ~/.bash_profile
(or ~/.profile
or ~/.bashrc
or ~/.zshrc
) so that you may run the binary from the command line:
Or, you can install on a per project basis, rather than globally to your host system.
Then the command would be found in your vendor/bin
folder, so you'd run this at your command line:
All versions of cli with dependencies
symfony/event-dispatcher Version ~2.7|~3.0
psy/psysh Version ~0.5.1
xamin/handlebars.php Version 0.10.*
composer/ca-bundle Version ^1.0
vlucas/phpdotenv Version ~2.4
craft-cli/bootstrap Version ^0.2.0
craft-cli/base-command Version ~0.0
symfony/process Version ~2.7|~3.0