Skip to main content
  1. All Posts/

megh

Tools Open Source PHP WordPress

Megh

Megh is a command line interface for managing multiple applications (WordPress, Laravel, etc.) running simultaneously on port 80.

Requirements

Installing

Megh is tested on Mac and debian based systems, like Ubuntu.

Linux

wget -O - https://raw.githubusercontent.com/megh-sh/megh/master/install.sh | bash

Mac

Download and install Docker Desktop for Mac from here or install via brew:

brew cask install docker

Now install Megh CLI

composer global require megh/megh-cli

Commands

Available commands:

check    Check docker and proxy status
  create   Create a new site
  delete   Delete a site
  disable  Disable a site
  enable   Enable a site
  help     Displays help for a command
  install  Install and Configure Megh
  list     Lists commands
  start    Start Megh services
  stop     Stop Megh services

Initialization

After installing the CLI, a install command needs to be run to install the docker configuration.

# install and configure megh
megh install

# start the services
megh start

Site Commands

Creating, deleting and managing sites

Create a new site

Creating a site will automatically create a database and user for that site. For Laravel and WordPress sites, the credentials will be automatically replaced in the config or env file.

megh create example.com [--type=] [--php=] [--username=] [--email=] [--pass=] [--add-host]

Options:
--type: Type of the site. php, wp, laravel. Defaults to php.
--php: The PHP version. 7.2, 7.3, 7.4. Defaults to 7.4.
--username: The WordPress admin username if --type=wp. Default is megh
--email: The WordPress admin email if --type=wp. Default is megh@example.com
--pass: The WordPress admin password if --type=wp. A default password will be generated in nothing provided.
--add-host: Wheather to add the domain to the hosts (/etc/hosts) file. Default is false

# WordPress
megh create example.com --type=wp

# WordPress with credentials
megh create example.com --type=wp --username=john --email=john@doe.com --pass=johndoe

# Laravel
megh create example.com --type=laravel

Delete a site

The site will be deleted along with database and files.

megh delete example.com

Disable a site

It temporary disables a site. Docker compose down and removes the site from the network.

megh disable example.com

Enable a site

Enables a disabled site. Docker compose up and connects back to the network.

megh enable example.com