PHPackages                             magegyver/m2devbox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. magegyver/m2devbox

ActiveLibrary[CLI &amp; Console](/categories/cli)

magegyver/m2devbox
==================

🚀 Quickly create Magento 2 development environments.

1.2.2(4y ago)1781[1 issues](https://github.com/MageGyver/m2devbox/issues)MPL-2.0PHPPHP ^7.4||^8.0CI failing

Since Mar 10Pushed 4y ago5 watchersCompare

[ Source](https://github.com/MageGyver/m2devbox)[ Packagist](https://packagist.org/packages/magegyver/m2devbox)[ Docs](https://github.com/MageGyver/m2devbox)[ GitHub Sponsors](https://github.com/sponsors/aeno)[ Fund](https://ko-fi.com/aenogym)[ RSS](/packages/magegyver-m2devbox/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (9)Versions (9)Used By (0)

m2devbox
========

[](#m2devbox)

 [![Latest release](https://camo.githubusercontent.com/053edf270154142214fe1df6ab75e8ee9f0145345f74d9047fbddeb69567acf3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f4d61676547797665722f6d32646576626f78)](https://camo.githubusercontent.com/053edf270154142214fe1df6ab75e8ee9f0145345f74d9047fbddeb69567acf3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f4d61676547797665722f6d32646576626f78) [![Magento 2.x](https://camo.githubusercontent.com/1340a2edb1506884001d64363dab372aeb9485db3490f4a8f982ce25c127d770/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6167656e746f2d322e332e342b2d6f72616e67653f6c6f676f3d6d6167656e746f)](https://camo.githubusercontent.com/1340a2edb1506884001d64363dab372aeb9485db3490f4a8f982ce25c127d770/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6167656e746f2d322e332e342b2d6f72616e67653f6c6f676f3d6d6167656e746f) [![Docker 17.05+](https://camo.githubusercontent.com/81b1253910ebfbffe0e5f36f51089e79db6bfa3e3121ff4556aad5867ad2baae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f636b65722d31372e30352b2d626c75653f6c6f676f3d646f636b6572)](https://camo.githubusercontent.com/81b1253910ebfbffe0e5f36f51089e79db6bfa3e3121ff4556aad5867ad2baae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f636b65722d31372e30352b2d626c75653f6c6f676f3d646f636b6572) [![License: MPL-2.0](https://camo.githubusercontent.com/024190deebfcdb2cbb1d463d29a6c01e1ed66605145833a28c3df2acedf50ea8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d504c2d2d322e302d627269676874677265656e)](https://camo.githubusercontent.com/024190deebfcdb2cbb1d463d29a6c01e1ed66605145833a28c3df2acedf50ea8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d504c2d2d322e302d627269676874677265656e)

The goal of m2devbox is to accelerate setting up development environments for Magento 2.

If you are developing a Magento 2 module and want to quickly test it in multiple release versions of Magento, you can simply start your preferred Magento release, and your module(s) will be automatically available inside it!

m2devbox is **not** intended to create a production Magento 2 Docker setup.

[![m2devbox terminal demo animation](./docs/demo.gif)](./docs/demo.gif)

---

📝 Requirements
--------------

[](#-requirements)

- Docker 17.05+
- PHP ^7.4||^8.0
- php-zlib

m2devbox can make use of the newer [BuildKit](https://www.docker.com/blog/advanced-dockerfiles-faster-builds-and-smaller-images-using-buildkit-and-multistage-builds/)Docker backend that results in a faster build process with smaller Docker images. m2devbox automatically uses BuildKit if it finds a Docker Engine 18.09 or above.

🛠️ Installation
---------------

[](#️-installation)

m2devbox is available as a PHAR file or as a Composer package. You can use it locally in your project, or you can install it globally.

### Recommended: global PHAR installation

[](#recommended-global-phar-installation)

```
wget https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar
chmod u+x m2devbox.phar
mv m2devbox.phar /usr/local/bin/m2devbox
m2devbox status
```

Download the [latest PHAR release](https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar)to your local machine, and move it to some directory that is accessible via `$PATH`. For moving, you might need superuser privileges:

```
sudo mv m2devbox.phar /usr/local/bin/m2devbox
```

Now you can run `m2devbox` anywhere.

### Local PHAR installation

[](#local-phar-installation)

```
wget https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar
php m2devbox.phar status
```

Download the [latest PHAR release](https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar)to your current working directory and use it right away.

### Local Composer installation

[](#local-composer-installation)

```
composer require magegyver/m2devbox
php vendor/bin/m2devbox status
```

Require `magegyver/m2devbox` in your local project and run it from the `vendor/bin/` directory.

🧰 Workflows
-----------

[](#-workflows)

With m2devbox, you can quickly spin up a Magento 2 instance and start developing and testing Magento 2 extensions inside it.

There are two main use cases in m2devbox:

### Creating a new blank module and start a suitable Magento 2 instance.

[](#creating-a-new-blank-module-and-start-a-suitable-magento-2-instance)

This is the primary use case of m2devbox, and it is most useful if you want to start building a new module and need a working Magento 2 environment.

m2devbox will create a blank Magento 2 module in your working directory. Then it creates a vanilla Magento installation in your host system's cache directory (i.e. `~/.cache/m2devbox`), builds a Docker setup containing this installation and mounts your new module into `app/code/`.

### Starting a plain Magento 2 instance.

[](#starting-a-plain-magento-2-instance)

If you already have one or more modules and want to test them in any given Magento 2 instance, this mode is right for you.

m2devbox creates a vanilla installation of Magento 2 in your host system's cache directory (i.e. `~/.cache/m2devbox`), builds a Docker setup containing this installation and mounts `./app_code/` into the container's Magento `app/code/`directory.

💻 Usage
-------

[](#-usage)

### Create a new blank module and start a suitable Magento 2 instance

[](#create-a-new-blank-module-and-start-a-suitable-magento-2-instance)

1. Create an empty working directory and execute `m2devbox start-module`inside it
2. Answer a few basic questions regarding your module (i.e. name and desired Magento 2 version).
3. Wait a moment while m2devbox creates a blank module and starts your Magento 2 instance. ☕
4. Add `127.0.0.1    m2.docker` to your `/etc/hosts` file, to be able to access your site.
5. Navigate to  and see your modules in action!

### Only start a Magento 2 instance

[](#only-start-a-magento-2-instance)

1. Navigate to a project directory somewhere on your machine.
2. Create an `app_code/` directory. This directory will be mounted into the `app/code/` directory of your Magento 2 instance and holds all your module source code.
3. ***(optional)*** Create a `.env` file in the root of your project directory to customize m2devbox settings for your project (see below).
4. Start an instance with your desired Magento 2 version: `m2devbox start 2.4.2`
5. Add `127.0.0.1    m2.docker` to your `/etc/hosts` file, to be able to access your site.
6. Navigate to  and see your modules in action!

🔨 Custom `.env` settings
------------------------

[](#-custom-env-settings)

You can customize some aspects of m2devbox by defining variables in a `.env`file. Create a plain-text file called `.env` in your project folder and put each variable you want to use in a new line. Assign a value to each variable, separating the variable and value with an `=` (without spaces).

VariableDefault valueDescriptionM2D\_MAGE\_VERSION-Magento version to start for this project.M2D\_APP\_CODE./app\_code/The directory where you put your modules. This will be mounted to app/code/ inside the Docker container.M2D\_MAGE\_WEB\_DOMAINm2.dockerWeb domain used to access the site from your hostM2D\_WEB\_PORT8080Web port used to access the site from your hostM2D\_DB\_PORT33306MySQL port used to access the database from your hostM2D\_ES\_PORT9200Elasticsearch port used to access ES from your hostM2D\_ES\_CONTROL\_PORT9300Elasticsearch control port used to access ES from your hostM2D\_REDIS\_PORT6379Redis port used to access Redis from your hostM2D\_TIMEZONEEurope/BerlinTimezone to use in Magento 2M2D\_MAGE\_ADMIN\_USERadminMagento 2 admin user nameM2D\_MAGE\_ADMIN\_PASSAdmin123!Magento 2 admin user passwordM2D\_MAGE\_LANGen\_USMagento 2 backend language for the admin accountM2D\_MAGE\_CURRENCYEURDefault Magento 2 currencyM2D\_DC\_PROJECT\_NAMEm2devboxDocker compose project name.🎓 CLI Command reference
-----------------------

[](#-cli-command-reference)

### Check currently running instances

[](#check-currently-running-instances)

```
m2devbox [status]
```

Running `m2devbox` without arguments or with the `status` argument displays an overview of what instances are built and currently running.

### Create a blank module

[](#create-a-blank-module)

```
m2devbox start-module [options]
```

This command creates a blank Magento 2 module inside the specified project directory, consisting of only the basic `registration.php` and `etc/module.xml`files.
Depending on your given options, m2devbox will create a PhpStorm project folder (`.idea/`) pre-configured with settings for the official [Magento 2 PhpStorm Plugin](https://github.com/magento/magento2-phpstorm-plugin).

OptionDefault valueDescription`--vendor`-Your module's vendor name`--module`-Your module's name`--project-path`(current working dir)The directory where the module files will be created`--phpstorm`-If supplied, create a PhpStorm project directory (`.idea/`) with the module`--start`-If supplied, directly start the Magento 2 instance after creating the module`--mage-version`(latest version)*(mandatory only if `--start` or `--phpstorm` are supplied)* The Magento 2 version to start or configureYou can either supply these options via command line arguments, or interactively answer questions when running the command without arguments.

### Start the current project's default instance

[](#start-the-current-projects-default-instance)

```
m2devbox start
```

To start the instance of Magento 2 that is configured in the current working directory's `.env` file, simply run `m2devbox start` without an explicit version string.

### Start a specific Magento version

[](#start-a-specific-magento-version)

```
m2devbox start
```

To start an specific instance of Magento 2 simply provide the desired release version as an argument for `m2devbox start`.

If there does not exist an instance for this version yet, m2devbox automatically starts downloading and installing it for you. You can grab a cup of coffee or simply look at the progress indicator while m2devbox sets up everything for you.

If an instance of this version is already started, it will be stopped and restarted again.

### Stop the currently running instance

[](#stop-the-currently-running-instance)

```
m2devbox stop
```

This command stops the currently running Magento 2 instance (only one instance can be running at the same time).

### Clear an instance

[](#clear-an-instance)

```
m2devbox clear [options] []
```

This command stops the given instance(s) and deletes the associated Magento 2 source files and database.

Argument/OptionOptional?Description`--yes`*optional*Answer all interactive questions with "yes"`versions`*optional*Space-separated list of versions to be cleared or leave blank to clear all versions.### Running CLI commands inside an instance

[](#running-cli-commands-inside-an-instance)

```
m2devbox cli [] []
```

This command runs CLI commands inside a started container. If you run `m2devbox cli` without any arguments, a new `bash` session inside the `web` container will be started for you. This is mostly useful if you want to run different Magento CLI commands like `bin/magento cache:clean`.

ArgumentOptional?DescriptionDefault value`container`*optional*Container name to run the command in. Allowed values: `web` || `db` || `elastic``web``command`*optional*Command to run in the container.`bash`👍 Supported Magento versions
----------------------------

[](#-supported-magento-versions)

- 2.3.4, -p2
- 2.3.5, -p1, -p2
- 2.3.6, -p1
- 2.3.7, -p3
- 2.4.0, -p1
- 2.4.1, -p1
- 2.4.2, -p1, -p2
- 2.4.3, -p1, -p2
- 2.4.4

⚖️ License
----------

[](#️-license)

m2devbox is licensed under the [Mozilla Public License, v. 2.0](https://mozilla.org/MPL/2.0/).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~84 days

Total

8

Last Release

1494d ago

Major Versions

0.2.2 → 1.0.02021-05-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/598616?v=4)[aeno](/maintainers/aeno)[@aeno](https://github.com/aeno)

---

Top Contributors

[![aeno](https://avatars.githubusercontent.com/u/598616?v=4)](https://github.com/aeno "aeno (113 commits)")

---

Tags

clidevelopmentdevopsdockerdocker-composemagentomagento2phpphpmagentodevelopmentdevopsdockermagento2docker-compose

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/magegyver-m2devbox/health.svg)

```
[![Health](https://phpackages.com/badges/magegyver-m2devbox/health.svg)](https://phpackages.com/packages/magegyver-m2devbox)
```

###  Alternatives

[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[drupal/console-core

Drupal Console Core

13514.7M12](/packages/drupal-console-core)[mahocommerce/maho

Free and open source ecommerce platform, created in 2024 on the M1 platform, PHP 8.3+

1322.1k12](/packages/mahocommerce-maho)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
