Download the PHP package j-stam/magento2-shell without Composer

On this page you can find all versions of the php package j-stam/magento2-shell. 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 magento2-shell

Magento 2 Shell

Creating a new console action can be overkill from time to time. Sometimes we just want to run a simple script on our magento application for example to test some code or run a one time action.

This package allows you to run actions on your magento installation like we did on magento 1.

Install

Install the package

Copy the shell folder from this package to your magento 2 root

Usage

Set Area code

The area code defaults to global. To use a different area code you can set it by overwriting the protected $appAreaCode; in your shell script

The following areas can be set:

Set Is Secure

Some magento actions for instance removing products are required to be executed in a secure area next to being executed in the adminhtml area. Use protected function setIsSecureArea($isSecure) to set wether the current area is secure or not.

Instantiate object

Use dependency injection.

The dependency injection uses the public function getInstance($type) to load your dependency. If you want to create a new instance, inject a factory for the object you are trying to create and use its create method or use the createInstance method instead of dependency injection

Export data to csv, xml, json

Read data from csv, xml, json

Excecute sql querys

You can run sql queries with the standard \Magento\Framework\DB\Adapter\AdapterInterface

Write output to a log file

You can write output to a log file using monologger. To set your log file name overwrite the protected $logFileName. When this variable is not set, your class name will be converted from PascalCase to lowercase seperated with dashes.

To write output to your log use the protected $logger

All log files are placed in {magento_root}/var/log/shell/ by default. To specify your own log file path overwrite the protected $logFilePath variable.

Write output to terminal

Available in the shell is the symfony console output class. This can be used directly by accessing the protected $consoleOutput. Or if you just want to write (a line) you can use the public functions write($messages, $newLine = true, $options = OutputInterface::OUTPUT_NORMAL) and writeln($message, $options = OutputInterface::OUTPUT_NORMAL)

Example script


All versions of magento2-shell with dependencies

PHP Build Version
Package Version
No informations.
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 j-stam/magento2-shell contains the following files

Loading the files please wait ....