Upgrading from Magento <=2.2.x to 2.3.x

At some point you’re going to want to upgrade your Magento project from 2.0/2.1/2.2 to the latest 2.3.x release to take advantage of new functionality and many improvements. There are a few manual changes that get in the way of the standard composer update that you’re used to. Thankfully, to accommodate this obstacle a tool was included in the codebase to automate these changes for you.


# Create a fresh Magento 2.3 project via composer (or clone the repo and switch to a 2.3 tag/branch, or grab the script by itself..)
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition=2.3 m23base

# Change working directories to the upgrade tools directory in your new project
cd m23base/dev/tools/UpgradeScripts


# Run the 2.3 upgrade assistant against the root of the Magento project you’re intending to upgrade
php -f pre_composer_update.php — –root=/path/to/magento-installation –repo=https://repo.magento.com/


– Updated composer.json
– Updated update/composer.lock
– Updated update/dev/tests

Change working directories to the root of the Magento project you’ve begun updating and complete the remaining steps.

cd /path/to/magento-installation

# Update Magento and all dependencies
composer update

# Clear the cache
rm -rf /var/cache/*
rm -rf /var/page_cache/*

# Remove any generated code
rm -rf /var/generation
rm -rf /generated/code/*

# Run Magento upgrade scripts
php bin/magento setup:upgrade

# Reindex after upgrade
php bin/magento i:rei

# Flush cache after reindex
php bin/magento c:f


– https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html#upgrade-cli-script

M2: Composer Bash Alias

At times you may need to quickly spin up a new, clean Magento 2 install. To simplify this process I added an alias for creating a new Magento 2 environment with composer. If you’re using Oh-My-Zsh as well then its as simple as nano ~/.zshrc and adding the following to the bottom of your configuration.

alias newm2="composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition ."

newm2 bash composer alias

Once you’re all set up you can run newm2 in any folder and this will automatically grab whatever the latest version is from Magento’s repo and create a new composer based env for you to continue testing/debugging/etc.

If you use any other shell this will still work but you’ll need to locate the proper configuration file for registering your alias (eg ~/.bashrc).

M2: Marketplace EQP Code Standards + PHPStorm

What is MEQP?

Magento EQP Coding Standard is a set of rules and sniffs for PHP_CodeSniffer tool.

It allows automatically check your code against some of the common Magento and PHP coding issues, like:

– raw SQL queries;
– SQL queries inside a loop;
– direct class instantiation;
– unnecessary collection loading;
– excessive code complexity;
– use of dangerous functions;
– use of PHP superglobals;
– code style issues
– and many others.

Read more about it and see the source: Github: Magento Marketplace EQP

How do I use it?

This tool can be run via CLI against any extension by giving it the path but you can also more tightly integrate it into your development workflow with the following steps:

cd /path/to/your/docroot
mkdir meqp && cd meqp
git clone https://github.com/magento/marketplace-eqp.git .
composer install

Next open up PHPStorm and navigate to Preferences > Languages & Frameworks > PHP > Code Sniffer

You can set it to use the version of PHP_CodeSniffer installed with composer in the steps above. Just use “/path/to/your/docroot/meqp/vendor/bin/phpcs” as the path.

Next navigate to Preferences > Editor > Inspections > PHP > PHP Code Sniffer Validation

– Check “Show warnings as” and “Show Sniff Name”
– Choose MEQP2 from the down ( or MEQP1 for Magento 1.x code )
Originally posted as:
– Choose Coding Standard Custom
– Set your path tp the ruleset: “/path/to/your/docroot/meqp/MEQP2/ruleset.xml”

Thats it, now you can write your code according to Magento’s standards! You should see notifications right alongside your code indicating the issue and the sniff that is triggering it.


Updated for clarity and accuracy 3/25/2018.

Utils: Laravel + phpDocs + Static Code Analysis

If you’re using an IDE like PHP Storm then this is a necessity to your project:


More Reading:


Also, if you use PHPStorm, add this to help improve your code quality:

Php Inspections (EA Extended) – static code analysis

Syncing Forks Without Merge Commits

I was looking for a quick way to sync a forked GitHub repository that had upstream changes without using their interface to create a pull request (doing so would result in a merge commit showing up in the list of commits when I submit another pull request).

Thats when I found Upriver.

Pretty straightforward:

  • Give it authorization to use your GitHub account.
  • Tell it which branches to sync
  • Click Pull

Thanks for the cool tool @bardiharborow