Version 3 is out, see what's new

Mage

Mage is a tool built on top of bin/magento that makes Magento 2 and Mage-OS development faster, with shortcuts and helpers for the work you repeat every day.

~/Sites
mage create my-shop
cd my-shop
mage add hyva
mage open admin

Features

Install

Download the script with curl:

curl -O https://raw.githubusercontent.com/GrimLink/mage/main/mage && chmod +x mage

Or with wget:

wget https://raw.githubusercontent.com/GrimLink/mage/main/mage && chmod +x mage

Then move it to a folder in your PATH, such as ~/.local/bin:

mv mage ~/.local/bin/

Requirements

Updating

Mage updates itself, together with its templates:

mage self-update

Commands

Anything mage does not know runs bin/magento, so mage cache:clean just works. Run mage help for the full list, including help, version and self-update.

Projects

create
Create, install and set up a new project
setup
Install Magento on an existing codebase
nuke
Permanently delete a project (database, environment, files)
backup
Back up the database, and optionally the media
restore
Restore a backup, and set it up for this device
sync
Pull the media, and optionally the latest backup, from a server

Add to a project

add
Add a package, git repository, composer fragment or handler
add theme
Create a child theme
add module
Create a module
add hyva
Add the Hyvä Theme
add sample
Add the Luma or the Koti sample data
add patch
Add composer patches, or create one from changes in vendor
add bfcache
Add the BFCache compatibility patches
add store
Create a store view with its own domain
add i18n
Collect the translations of a module or theme
add admin
Create an admin user
add customer
Create a customer
add storeinfo
Add the Siteation StoreInfo modules

Packages and modules

del
Remove packages by name or term
upd
Update packages by name or term
enable, disable
Enable or disable modules by name or term
outdated
List the direct dependencies with a newer version

Daily work

watch
Clean only the caches a file change affects
build
Build themes with their npm scripts, or watch one
log
Follow a log in var/log
reindex
Reindex, then clean the cache
clean
Clean caches and generated files (alias purge)

Insight and settings

info
Show the version, mode, urls, Redis and more of the project
open
Open a store view, the admin or the mail catcher
show
Show stores, themes, modules, logs or the full page cache
set
Change a setting, such as the CSP or full page cache
run
Run n98-magerun2

Learn more

The docs describe each command, the configuration and the environments, and the changelog lists what changed in every release.