PHPackages                             staempfli/magento2-builder-tool - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. staempfli/magento2-builder-tool

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

staempfli/magento2-builder-tool
===============================

Staempfli AG Magento2 Builder Tool

3.0.0(7y ago)41131.6k—0%9[1 PRs](https://github.com/staempfli/magento2-builder-tool/pulls)GPL-3.0-onlyPHP

Since May 24Pushed 5y ago12 watchersCompare

[ Source](https://github.com/staempfli/magento2-builder-tool)[ Packagist](https://packagist.org/packages/staempfli/magento2-builder-tool)[ RSS](/packages/staempfli-magento2-builder-tool/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (25)Used By (0)

Magento 2 Builder tool
======================

[](#magento-2-builder-tool)

[![Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development.](https://camo.githubusercontent.com/14a8e7234bd98508cfd9903b34d873f772f8bad5efc410eddd157e9561fa51e6/687474703a2f2f7777772e7265706f7374617475732e6f72672f6261646765732f6c61746573742f6162616e646f6e65642e737667)](http://www.repostatus.org/#abandoned)[![Codacy Badge](https://camo.githubusercontent.com/ec6195e96164fb2bc3a9f5f11a6df65f61f7876abd38f984d2d90b12c25ea34c/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6139666463626236623462353432656539393238383865646138373661643531)](https://www.codacy.com/app/Staempfli/magento2-builder-tool?utm_source=github.com&utm_medium=referral&utm_content=staempfli/magento2-builder-tool&utm_campaign=Badge_Grade)[![Maintainability](https://camo.githubusercontent.com/599505252efae4f81042debf233fa606c9e10fcad0f50880d28f5f7fe89bb0ce/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31353734633430313864386439303532303537322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/staempfli/magento2-builder-tool/maintainability)

Tool to automatically build Magento2 projects and sync data from remote servers.

#### Local environments:

[](#local-environments)

- Set up local environment (DB, config, Server)
- Install project's real data (Sync from Server)

#### CI / Build Environments:

[](#ci--build-environments)

- Prepare DB and configurations for executing tests.
- Build and transfer artifacts ready to be deployed on a server.

Installation
------------

[](#installation)

```
composer require "staempfli/magento2-builder-tool":"~2.0"

```

Demo
----

[](#demo)

[ ![Magento2 Builder Playlist](docs/images/youtube/playlist.png)](https://www.youtube.com/watch?v=wXt04uaZK7M&list=PLBt8dizedSZDtc1kEH2iCJGodWqQ5T6XN)Introduction
------------

[](#introduction)

`magento2-builder-tool` is a tool to setup local environments for your Magento2 projects by executing one command. No Docker, no Vagrant needed but it is also compatible inside those virtualised setups. Database, Apache/Nginx configuration and everything else are created automatically for each project. You can even use `sync` mode to get server data copied locally.

This tool is also meant for `CI` or `Build` environments to automate the step of creating the artifact.

What this tool does for you:

### LOCAL Environment

[](#local-environment)

```
1. Create Magento Database
2. Create Integration Test Database
3. Magento Install
4. Sync Data From Server
5. Update core_config_data for your environment
6. setup:upgrade
7. clean cache
8. Setup Apache/Nginx configuration

```

Only manual step is to edit your `/etc/hosts`. If you want to automate that too, see [DnsMasq on MAC](#dnsMasq-on-mac)

### CI / Build Environment

[](#ci--build-environment)

```
- Create DB for integration tests
- Builds and transfer artifact that can be directly deployed on a server

```

Setup
-----

[](#setup)

### Config Folder

[](#config-folder)

```
cp -r /staempfli/magento2-builder-tool/config.sample/ config

```

- Set the project languages and other configuration into `config/project.properties` or `config/mg2-builder/build.properties`
- Set the project custom `core_config_data` on `config/mg2-builder/magento/config.yaml`
- Set the project servers settings on `config/mg2-builder/server/config.yaml`

**NOTE:** You only need to replace parameters between `` with your corresponding values. All other placehoders like `${}` or `{{}}` will be automatically replaced during the tool execution

### Create logs folder

[](#create-logs-folder)

```
mkdir logs
vim logs/.gitignore
# Ignore everything in this directory
*
# Except this file
!.gitignore

```

### Custom Properties

[](#custom-properties)

You can customise all properties according to your needs:

- Properties added in `config/mg2-builder/build.properties` and `config/project.properties` have higher priority and will overwrite default ones
- Check all properties that can be customised here:
    - [build/config/default.properties](build/config/default.properties)

LOCAL Environaments
-------------------

[](#local-environaments)

### Usage

[](#usage)

- List available targets:

    - `bin/mg2-builder -l`
- Project install:

    - `bin/mg2-builder install`
- Sync data from server:

    - `bin/mg2-builder sync`

### TIPS

[](#tips)

#### Local settings

[](#local-settings)

If you do not want to input over and over again the properties required, you can setup your default environment parameters as follows:

1. Create folder `_conf` at one level higher than your project root.
2. Add a new file `environment.properties` inside that folder.
3. Inside this file you can specify your environment properties as follows:

```
project.environment= (usually Local)
database.admin.username=
environment.server.type= (apache, nginx or none)
environment.vhosts.dir=

```

#### SSH without password

[](#ssh-without-password)

To skip entering the ssh password every time, you can use `ssh-copy-id` to automatically set the public-private keys on the server. Simply execute:

```
ssh-copy-id user@server-domain

```

#### DnsMasq on MAC

[](#dnsmasq-on-mac)

On `OS X` you can even skip the manual step of editing the `etc/hosts` by using `dnsmasq`. You can configure it to automatically load all `*.dev` or `*.lo` urls (`*.local` does not work).

- [Never Touch Your Local /etc/hosts File in OS X Again](http://alanthing.com/blog/2012/04/24/never-touch-your-local-etchosts-file-os-x-again/)

**NOTE**: When adding a new `dnsmasq`, you need to reload the `dnsmasq daemon`:

```
sudo launchctl unload -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

```

CI / Build Environments
-----------------------

[](#ci--build-environments-1)

### Usage

[](#usage-1)

- Create DB and settings for integration tests:

    - `bin/mg2-builder tests-setup:install`
- Create and transfer built artifact:

    - `bin/mg2-builder artifact:transfer [-Dartifact.name, -Duse.server.properties]`

Custom scripts
--------------

[](#custom-scripts)

If you need additional scripts to build your projects, you can add them here:

- `config/mg2-builder/xmlscripts/custom.xml`

You can also define targets that will be automatically executed during the build process. This tool contains `customHooks` that can be listened to dispatch other targets. You can set inside `config/mg2-builder/project.properties` the targets to be executed by these hooks:

```
vim config/mg2-builder/xmlscripts/custom.xml
before-magento-install =
after-sync =
after-tests-setup-integration =
after-util-db-clean =

```

Disclaimer
----------

[](#disclaimer)

In order to use sync functionalities, `n98-magenrun2` must be available on the remote server. The easiest way is to add it as part as your project dependencies:

```
composer require "n98/magerun2":"^1.4"

```

If you install `n98-magerun2` in your server in another way, be sure to configure the parameter `sync.bin.n98-magerun2` accordingly:

- [build/config/default.properties#L26](build/config/default.properties#L26)

Troubleshooting
---------------

[](#troubleshooting)

#### Set null config values on magento version 2.2.x

[](#set-null-config-values-on-magento-version-22x)

- **Problem**: [PR #15216](https://github.com/magento/magento2/pull/15216)
- **Solution**: Apply patch directly in your project using composer

```
"require": {
	"cweagans/composer-patches": "^1.0"
},
"extra": {
	"patches": {
		"magento/module-config": {
			"Make possible to set null values using config:set command": "https://stash.staempfli.com/projects/MAG/repos/magento2-patches/raw/patches/2.2.x/config-set-null-value/version-2.2.0.patch"
		}
	},
	"composer-exit-on-patch-failure": true
}

```

**NOTE**: use `version-2.2.0.patch` for magento `>=2.2.0 =2.2.4`

#### MySQL server has gone away

[](#mysql-server-has-gone-away)

- **Problem**: `MySQL` crashes sometime when creating, importing or updating the Magento database.
- **Solution**: Add following configuration in your `.my.cnf`

    - Gist: [.my.conf](https://gist.github.com/jalogut/f507f13b27f7a63d936edd58fad5e121)
- **How to restart mysql**: Kill MySQL process, start MySQL and try again:

    1. `killall -9 mysqld`
    2. `mysql.server start` or `mysql.server restart`
    3. Try again: `mg2-builder install`

Prerequisites
-------------

[](#prerequisites)

- PHP &gt;= 7.0.\*
- Mysql &gt;= 5.7.\*

ChangeLog
---------

[](#changelog)

[CHANGELOG.md](CHANGELOG.md)

Developers
----------

[](#developers)

- [Juan Alonso](https://github.com/jalogut)

Licence
-------

[](#licence)

[GNU General Public License, version 3 (GPLv3)](http://opensource.org/licenses/gpl-3.0)

Copyright
---------

[](#copyright)

(c) 2017 Staempfli AG

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 84.9% 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 ~32 days

Recently: every ~61 days

Total

22

Last Release

2590d ago

Major Versions

1.2.2 → 2.02018-04-25

2.2.1 → 3.0.02019-04-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/402069?v=4)[Marcel Hauri](/maintainers/mhauri)[@mhauri](https://github.com/mhauri)

![](https://www.gravatar.com/avatar/71706506f6589b5436c45edfcf1ae57d8ced0d5571c06fdd48cf97d41b0bbcb8?d=identicon)[staempfli-webteam](/maintainers/staempfli-webteam)

![](https://www.gravatar.com/avatar/0039026286692f2f4f9df99a2625870ca1b157114920093ce0ff89fb5756e064?d=identicon)[audef1](/maintainers/audef1)

---

Top Contributors

[![jalogut](https://avatars.githubusercontent.com/u/6410900?v=4)](https://github.com/jalogut "jalogut (62 commits)")[![audef1](https://avatars.githubusercontent.com/u/4160004?v=4)](https://github.com/audef1 "audef1 (9 commits)")[![adrian-martinez-interactiv4](https://avatars.githubusercontent.com/u/17545750?v=4)](https://github.com/adrian-martinez-interactiv4 "adrian-martinez-interactiv4 (2 commits)")

---

Tags

toolenvironmentdevelopmentsyncbuildmagento2

### Embed Badge

![Health badge](/badges/staempfli-magento2-builder-tool/health.svg)

```
[![Health](https://phpackages.com/badges/staempfli-magento2-builder-tool/health.svg)](https://phpackages.com/packages/staempfli-magento2-builder-tool)
```

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k602.4M5.4k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k226.7M2.3k](/packages/symfony-dotenv)[phing/phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.

1.2k21.7M876](/packages/phing-phing)[bamarni/composer-bin-plugin

No conflicts for your bin dependencies

52722.0M859](/packages/bamarni-composer-bin-plugin)[zepgram/magento-dotenv

Simple autoloader to integrate the Symfony Dotenv component into Magento2

1371.3k](/packages/zepgram-magento-dotenv)

PHPackages © 2026

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