Using console commands

Working with CLI

We have our PHP compiled, Composer installed, Magento 2 installed. But how access them? Everything is scattered across the file system.
That is where CLI comes in handy. It provides aliases for PHP, Composer and Magento in your project. We can open it by running a command:
npm run cli # for NPM
yarn cli # for Yarn
Now we have access to PHP, Composer and Magento, we can install PHP dependencies, upgrade Magento and so on.
php -v
> PHP 7.4.13 (cli) ...
composer --version
> Composer version 1.10.19
# Can be used with alias
c --version
> Composer version 1.10.19
magento setup:upgrade
> Magento upgrade output ...
# Can be used with alias
m se:up
> Magento upgrade output ...

Common Usage

Flushing Magento cache
magento cache:flush
# or with aliases and shortcuts
m c:f
Magento upgrade
magento setup:upgrade
# or with aliases and shortcuts
m se:up
Upgrading Composer dependencies
composer upgrade
# or with alias
c upgrade
Copy link
On this page
Working with CLI
Common Usage