Skip to main content
Version: 1.0.0

Console Commands

Using Console Commands in Craft CMS

Craft CMS provides a robust command-line interface (CLI) that allows you to perform various tasks directly from the terminal. This can be particularly useful for automating repetitive tasks, managing deployments, and debugging. This guide will walk you through the basics of using console commands in Craft CMS.

Prerequisites

  • Ensure you have Craft CMS installed.
  • Access to the command line or terminal on your server or local development environment.
  • PHP installed and available in your command line.

Accessing the Craft CLI

The primary script for interacting with Craft CMS via the command line is craft. This script is located in the craft directory of your project. To use it, navigate to your project's root directory and run:

php craft

Running this command without any arguments will display a list of available commands.

Command Groups

Craft CMS commands are separated into two groups: Native Craft commands and YSCP plugin commands. Below is an overview of each group:

Conclusion

Using the command-line interface in Craft CMS can greatly enhance your workflow, allowing you to automate tasks, manage your application more efficiently, and extend the CMS's capabilities with custom commands. This guide covers the basics, but there are many more commands and possibilities to explore. For a complete list of available commands, refer to the official Craft CMS documentation.