{"id":15554968,"url":"https://github.com/magegyver/m2devbox","last_synced_at":"2025-07-15T03:43:23.884Z","repository":{"id":57016006,"uuid":"346365813","full_name":"MageGyver/m2devbox","owner":"MageGyver","description":"🚀 Head start your Magento 2 extension development with pre-configured Docker environments.","archived":false,"fork":false,"pushed_at":"2022-04-14T20:54:57.000Z","size":931,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-18T04:56:08.503Z","etag":null,"topics":["cli","development","devops","docker","docker-compose","magento","magento2","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MageGyver.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["aeno"],"patreon":null,"open_collective":null,"ko_fi":"aenogym","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-03-10T13:29:42.000Z","updated_at":"2024-10-27T22:54:20.000Z","dependencies_parsed_at":"2022-08-22T09:31:49.796Z","dependency_job_id":null,"html_url":"https://github.com/MageGyver/m2devbox","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MageGyver%2Fm2devbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MageGyver%2Fm2devbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MageGyver%2Fm2devbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MageGyver%2Fm2devbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MageGyver","download_url":"https://codeload.github.com/MageGyver/m2devbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250509547,"owners_count":21442447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","development","devops","docker","docker-compose","magento","magento2","php"],"created_at":"2024-10-02T15:05:25.700Z","updated_at":"2025-04-23T20:31:26.363Z","avatar_url":"https://github.com/MageGyver.png","language":"PHP","readme":"\u003ch1 align=\"center\"\u003em2devbox\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n   \u003cimg alt=\"Latest release\" src=\"https://img.shields.io/github/v/release/MageGyver/m2devbox\"\u003e\n   \u003cimg src=\"https://img.shields.io/badge/Magento-2.3.4+-orange?logo=magento\" alt=\"Magento 2.x\" /\u003e\n   \u003cimg src=\"https://img.shields.io/badge/Docker-17.05+-blue?logo=docker\" alt=\"Docker 17.05+\" /\u003e\n   \u003cimg src=\"https://img.shields.io/badge/License-MPL--2.0-brightgreen\" alt=\"License: MPL-2.0\" /\u003e\n\u003c/div\u003e\n\nThe goal of m2devbox is to accelerate setting up development environments for \nMagento 2.\n\nIf you are developing a Magento 2 module and want to quickly test it in multiple \nrelease versions of Magento, you can simply start your preferred Magento \nrelease, and your module(s) will be automatically available inside it!\n\nm2devbox is **not** intended to create a production Magento 2 Docker setup.\n\n![m2devbox terminal demo animation](./docs/demo.gif)\n\n--------------------------------------------------------------------------------\n\n## 📝 Requirements\n\n* Docker 17.05+\n* PHP ^7.4||^8.0 \n* php-zlib\n\nm2devbox can make use of the newer [BuildKit](https://www.docker.com/blog/advanced-dockerfiles-faster-builds-and-smaller-images-using-buildkit-and-multistage-builds/) \nDocker backend that results in a faster build process with smaller Docker \nimages. m2devbox automatically uses BuildKit if it finds a Docker Engine 18.09 \nor above.\n\n## 🛠️ Installation\n\nm2devbox is available as a PHAR file or as a Composer package. \nYou can use it locally in your project, or you can install it globally.\n\n### Recommended: global PHAR installation\n\n```shell\nwget https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar\nchmod u+x m2devbox.phar\nmv m2devbox.phar /usr/local/bin/m2devbox\nm2devbox status\n```\n\nDownload the [latest PHAR release](https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar) \nto your local machine,  and move it to some directory that is accessible via \n`$PATH`. For moving, you might need superuser privileges:   \n```shell\nsudo mv m2devbox.phar /usr/local/bin/m2devbox\n```\nNow you can run `m2devbox` anywhere.\n\n### Local PHAR installation\n\n```shell\nwget https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar\nphp m2devbox.phar status\n```\n\nDownload the [latest PHAR release](https://github.com/MageGyver/m2devbox/releases/latest/download/m2devbox.phar)\nto your current working directory and use it right away.\n\n### Local Composer installation\n\n```shell\ncomposer require magegyver/m2devbox\nphp vendor/bin/m2devbox status\n```\n\nRequire `magegyver/m2devbox` in your local project and run it from the \n`vendor/bin/` directory.\n\n## 🧰 Workflows\n\nWith m2devbox, you can quickly spin up a Magento 2 instance and start developing \nand testing Magento 2 extensions inside it.\n\nThere are two main use cases in m2devbox:\n\n### Creating a new blank module and start a suitable Magento 2 instance.\n\nThis is the primary use case of m2devbox, and it is most useful if you want to \nstart building a new module and need a working Magento 2 environment. \n\nm2devbox will create a blank Magento 2 module in your working directory. Then it\ncreates a vanilla Magento installation in your host system's cache directory \n(i.e. `~/.cache/m2devbox`), builds a Docker setup containing this installation \nand mounts your new module into `app/code/`.\n\n### Starting a plain Magento 2 instance.\n\nIf you already have one or more modules and want to test them in any given \nMagento 2 instance, this mode is right for you.\n\nm2devbox creates a vanilla installation of Magento 2 in your host system's cache\ndirectory (i.e. `~/.cache/m2devbox`), builds a Docker setup containing this\ninstallation and mounts `./app_code/` into the container's Magento `app/code/`\ndirectory. \n\n## 💻 Usage\n\n### Create a new blank module and start a suitable Magento 2 instance\n\n1. Create an empty working directory and execute `m2devbox start-module` \n   inside it\n2. Answer a few basic questions regarding your module (i.e. name and desired \n   Magento 2 version).\n3. Wait a moment while m2devbox creates a blank module and starts your Magento 2\n   instance. ☕\n4. Add `127.0.0.1    m2.docker` to your `/etc/hosts` file, to be able to access \n   your site.\n5. Navigate to http://m2.docker:8080 and see your modules in action!\n\n### Only start a Magento 2 instance\n\n1. Navigate to a project directory somewhere on your machine.\n2. Create an `app_code/` directory. This directory will be mounted into the \n   `app/code/` directory of your Magento 2 instance and holds all your module\n   source code.\n3. **_(optional)_** Create a `.env` file in the root of your project directory \n   to customize m2devbox settings for your project (see below).\n4. Start an instance with your desired Magento 2 version: `m2devbox start 2.4.2`\n5. Add `127.0.0.1    m2.docker` to your `/etc/hosts` file, to be able to access \n   your site.\n6. Navigate to http://m2.docker:8080 and see your modules in action!\n\n## 🔨 Custom `.env` settings\n\nYou can customize some aspects of m2devbox by defining variables in a `.env` \nfile. Create a plain-text file called `.env` in your project folder and put each\nvariable you want to use in a new line. Assign a value to each variable, \nseparating the variable and value with an `=` (without spaces).\n\n| Variable            | Default value | Description                                                                                              |\n|---------------------|---------------|----------------------------------------------------------------------------------------------------------|\n| M2D_MAGE_VERSION    | -             | Magento version to start for this project.                                                               |\n| M2D_APP_CODE        | ./app_code/   | The directory where you put your modules. This will be mounted to app/code/ inside the Docker container. | \n| M2D_MAGE_WEB_DOMAIN | m2.docker     | Web domain used to access the site from your host                                                        |\n| M2D_WEB_PORT        | 8080          | Web port used to access the site from your host                                                          |\n| M2D_DB_PORT         | 33306         | MySQL port used to access the database from your host                                                    |\n| M2D_ES_PORT         | 9200          | Elasticsearch port used to access ES from your host                                                      |\n| M2D_ES_CONTROL_PORT | 9300          | Elasticsearch control port used to access ES from your host                                              |\n| M2D_REDIS_PORT      | 6379          | Redis port used to access Redis from your host                                                           |\n| M2D_TIMEZONE        | Europe/Berlin | Timezone to use in Magento 2                                                                             |\n| M2D_MAGE_ADMIN_USER | admin         | Magento 2 admin user name                                                                                |\n| M2D_MAGE_ADMIN_PASS | Admin123!     | Magento 2 admin user password                                                                            |\n| M2D_MAGE_LANG       | en_US         | Magento 2 backend language for the admin account                                                         |\n| M2D_MAGE_CURRENCY   | EUR           | Default Magento 2 currency                                                                               |\n| M2D_DC_PROJECT_NAME | m2devbox      | Docker compose project name.                                                                             |\n\n## 🎓 CLI Command reference\n\n### Check currently running instances\n\n```shell\nm2devbox [status]\n```\n\nRunning `m2devbox` without arguments or with the `status` argument displays an \noverview of what instances are built and currently running.\n\n### Create a blank module\n\n```shell\nm2devbox start-module [options] \n```\n\nThis command creates a blank Magento 2 module inside the specified project \ndirectory, consisting of only the basic `registration.php` and `etc/module.xml`\nfiles.  \nDepending on your given options, m2devbox will create a PhpStorm project folder\n(`.idea/`) pre-configured with settings for the official [Magento 2 PhpStorm \nPlugin](https://github.com/magento/magento2-phpstorm-plugin).\n\n\n| Option           | Default value         | Description                                                                                              |\n|------------------|-----------------------|----------------------------------------------------------------------------------------------------------|\n| `--vendor`       | -                     | Your module's vendor name                                                                                |\n| `--module`       | -                     | Your module's name                                                                                       |\n| `--project-path` | (current working dir) | The directory where the module files will be created                                                     |\n| `--phpstorm`     | -                     | If supplied, create a PhpStorm project directory (`.idea/`) with the module                              |\n| `--start`        | -                     | If supplied, directly start the Magento 2 instance after creating the module                             |\n| `--mage-version` | (latest version)      | _(mandatory only if `--start` or `--phpstorm` are supplied)_ The Magento 2 version to start or configure |\n\nYou can either supply these options via command line arguments, or interactively answer questions when running the command without arguments.\n\n### Start the current project's default instance\n\n```shell\nm2devbox start\n```\n\nTo start the instance of Magento 2 that is configured in the current working\ndirectory's `.env` file, simply run `m2devbox start` without an explicit version\nstring.\n\n### Start a specific Magento version\n\n```shell\nm2devbox start \u003cversion\u003e\n```\n\nTo start an specific instance of Magento 2 simply provide the desired release version as \nan argument for `m2devbox start`.\n\nIf there does not exist an instance for this version yet, m2devbox automatically\nstarts downloading and installing it for you. You can grab a cup of coffee or\nsimply look at the progress indicator while m2devbox sets up everything for you.\n\nIf an instance of this version is already started, it will be stopped and \nrestarted again.\n\n### Stop the currently running instance\n\n```shell\nm2devbox stop\n```\n\nThis command stops the currently running Magento 2 instance (only one instance\ncan be running at the same time).\n\n### Clear an instance\n\n```shell\nm2devbox clear [options] [\u003cversions\u003e]\n```\n\nThis command stops the given instance(s) and deletes the associated Magento 2 \nsource files and database.\n\n| Argument/Option | Optional?  | Description                                                                          |\n|-----------------|------------|--------------------------------------------------------------------------------------|\n| `--yes`         | _optional_ | Answer all interactive questions with \"yes\"                                          |\n| `versions`      | _optional_ | Space-separated list of versions to be cleared or leave blank to clear all versions. |\n\n### Running CLI commands inside an instance\n\n```shell\nm2devbox cli [\u003ccontainer\u003e] [\u003ccommand\u003e]\n```\n\nThis command runs CLI commands inside a started container.\nIf you run `m2devbox cli` without any arguments, a new `bash` session inside the \n`web` container will be started for you. This is mostly useful if you want to \nrun different Magento CLI commands like `bin/magento cache:clean`.\n\n| Argument    | Optional?  | Description                                                                                          | Default value |\n|-------------|------------|------------------------------------------------------------------------------------------------------|---------------|\n| `container` | _optional_ | Container name to run the command in. Allowed values: `web` \u0026#124;\u0026#124; `db` \u0026#124;\u0026#124; `elastic` | `web`         |\n| `command`   | _optional_ | Command to run in the container.                                                                     | `bash`        |\n\n## 👍 Supported Magento versions\n\n* 2.3.4, -p2\n* 2.3.5, -p1, -p2\n* 2.3.6, -p1\n* 2.3.7, -p3\n* 2.4.0, -p1\n* 2.4.1, -p1\n* 2.4.2, -p1, -p2\n* 2.4.3, -p1, -p2\n* 2.4.4\n\n## ⚖️ License\n\nm2devbox is licensed under the [Mozilla Public License, v. 2.0](https://mozilla.org/MPL/2.0/).\n","funding_links":["https://github.com/sponsors/aeno","https://ko-fi.com/aenogym"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagegyver%2Fm2devbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagegyver%2Fm2devbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagegyver%2Fm2devbox/lists"}