Download the PHP package montikids/magento-cli-util without Composer

On this page you can find all versions of the php package montikids/magento-cli-util. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magento-cli-util

Magento 2 CLI Util

It doesn't work standalone: Magento 2 instance is required

The tool is designed to automate, simplify, and make it safe to convert the production environment into a staging or a development one. It can be used by developers manually or as a part of a deployment process to configure the staging environment.

It allows describing a scenario of sanitizing data in the database, Thus you can be sure you didn't forget to do something important, like disabling an integration locally (that can create a mess) or anonymizing customer emails (that could lead to accidental sending emails) and so on.

The util is based on the Symfony Console, so you must be already familiar with it. It's easy to use and to extend.

Features

Installation

Add the following content to the repositories section of your composer.json to make composer know where to search

You probably would get something like that, if your Magento is installed via composer

Then run composer update to update the composer.lock file and force composer to discover the new repository

Now you can require the package as usual

After installation you must configure the environment.

Usage / Commands

After installation the tool is available as a composer binary: vendor/bin/mk-cli-util

List commands

See all the commands currently available

List of available commands

Configure environment

Description

Before the first run, you must set the environment type you're going to use. Without it, you can't run other util commands for security reasons.

Available environments:

Syntax

Example

Normal use

For more verbosity

What does it do

It's recommended to add the mk-cli-util folder to git in order to share configs across your team and have the ability to easily adjust the rules when a new feature creates some points to sanitize.

Verify environment configuration files

Description

You always can check whether your configuration files are valid. It's extremely important in automated deployments when you rely on safe usage, and you really don't want accidentally miss the step of data cleaning and anonymization.

This command returns non-zero exit code in case of any failure. In case you have configured pipelines in your git, you can just add execution of this command to the pipelines and be aware about incorrect syntax of config even before merging it into master/develop. Pipelines are usually failed on any error occurred.

Otherwise, you need to verify the configs on deployment and, probably, fail the whole deployment when this check fails. Depending on how your deployment processes are made, you might need to track the exit code of this command and stop the deployment process explicitly when the exit code is non-zero value.

Syntax

Example

Check files for the current configured environment

Check files for another environment

What does it do

Anonymize DB data

Description

Running this command starts data anonymizing processing in the Magento database according to the scenario specified in the config(s).

Config paths:

Syntax

Example

Normal use

For more verbosity (see SQL queries are executed, the number of affected rows, and so on)

What does it do

Apply store config values

Description

Running this command starts applying store config values (core_config_data table) according to the scenario specified in the config(s).

Config paths:

Syntax

Example

Normal use

For more verbosity (see SQL queries are executed, the number of affected rows, and so on)

What does it do

Config types

Base

This config is required and created automatically during environment configuration.

It contains the main and the most common set of rules.

It's recommended to keep it under VCS

Environment-specific

These configs are optional. Config with the corresponding name is created automatically during environment configuration but you can't remove it if you don't need it. The base config is used in this case.

These configs are used to specify some rules that are specific per environment. They inherit the base config. The dev.yml config is intended to be used across the development team locally. The stage.yml is intended to be used during or after deployment on the staging.

It's recommended to keep them under VCS

Local

The config is optional, use it if you need a more specific config than the base and the environmental ones. Each developer machine or staging instance can have its copy.

It inherits both: the base config and the env (if there is one). In case there is no local config, the base and the environment-specific ones are used.

Should be excluded from VCS

Config merge logic

Priorities

  1. Local
  2. Environment-specific
  3. Base

i.e. the local config is the top-priority one.

Merge rules

Anonymize config

Contains rules of Magento tables data sanitizing.

Paths

Base config

Sections

Examples

The following example demonstrates the general approch to writing the sections and how to use YAML anchors (variables). For more extended samples, please check the corresponding folder in the repository.

Merge examples

Base config

Environment-specific config

Local config

The result

Store config values config

Contains rules of updating values of the core_config_data Magento table.

Syntax

Paths

Base config

Sections

Examples

The following example demonstrates the general approch to writing the sections. For more extended samples, please check the corresponding folder in the repository.

Merge examples

Base config

Environment-specific config

Local config

The result

Local development and testing

As far as the package can't exist standalone (without a Magento installation), developing it locally is quite a challenge.

It's highly recommended to use a copy of your Magento project in a separate folder. It should prevent you from constant modifying/reverting composer.json and composer.lock files and save you a lot of time and nerves. That's because local development requires adding the custom repository that points to the local directory

Preparing

There is a trick to make composer load the local version of the package instead of downloading it from the repository. Add the following content into the repositories section of your composer.json of your Magento installation.

where

symlink may seem a more convenient option to you but you probably would face some issues on using relative paths

If you have already installed the package

Unfortunately, in this case, the only solution that I found is to remove the composer.lock file. Without this, the repository URL isn't updated and you continue receiving the package from the repository instead of the specified local path.

Remove the package version you have and clean the composer cache

Run the installation of the packages and go to the kitchen to make yourself a cup of coffee

If it's the first installation

Require the package as usual

You should see something like this (pay attention to the word mirroring)

Developing

  1. Make the changes you need in the local folder with the package
  2. Remove the outdated version from the Magento project's vendor, clean cache, and run the installation of the missed package

I prefer to run it as a single command, it's much more convenient when you need to test your changes quite often

  1. Profit!

In case you modified the composer.json of the package (e.g. the version of one of the dependencies), you would have to update the composer.lock in your Magento project

If it doesn't help, remove the composer.lock and run

Authors


All versions of magento-cli-util with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0||^8.1||^8.2||8.3
ext-sodium Version *
ext-mysqli Version *
symfony/console Version >4.0
symfony/yaml Version >3.3
n98/magerun2-dist Version *
symfony/filesystem Version ^4||^5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package montikids/magento-cli-util contains the following files

Loading the files please wait ....