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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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

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

PHP Build Version
Package Version
Requires symfony/console Version ~2.7|~3.0
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package craft-cli/cli contains the following files

Loading the files please wait ....