Magento 2 has a wide range of tools that help you with developing modules. One of the well-known CLI tools in Magento is Magerun. This is an extension of Magento’s own CLI tool that already comes out of the box when you install Magento 2. One of my favorite tools that I use a lot is Pestle by Alan Storm.

Since much of our code we write mainly consists of templates (reusable) code, Pestle helps to generate a lot of this code. Ultimately, this saves a lot of time when it comes to developing Magento 2 modules.

What is Pestle?

You can think of Pestle as a PHP framework that helps you build and organize CLI programs in Magento 2. For example, you can extend existing functions such as the “generate” function with your own template.

For those who are familiar with Python, Pestle is similar to how Python imports modules.

It is also a collection of CLI programs with a focus on Magento 2 code generation.

Install Pestle

Pestle comes in the form of a .phar file (PHP Archive file) and is easy to download. Phar files are self-contained cross-platform, so it works on MacOS, Windows and Linux.

#with curl:
curl -LO http://pestle.pulsestorm.net/pestle.phar
#with wget:
wget http://pestle.pulsestorm.net/pestle.phar

Or you can download one of the other releases on their Github page.

Run the following

php pestle.phar versionto see which version is installed.

What are we going to build?

We are going to build a simple module with a front-end page that we can navigate to. After installing pestle, run

php pestle.pharto see a list of options.

We are particularly interested in the Magento 2 Generate options. To see only the “generate” options run:

php pestle.phar | grep generate --color=never

#magento2 #magento-development #magento-2 #magento-developer #php #magento #programming #coding

A Quick Guide to Magento 2 Module Development Using Pestle
2.05 GEEK