A Quick Guide to Magento 2 Module Development Using Pestle

A Quick Guide to Magento 2 Module Development Using Pestle

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.

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

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

A Complete Guide to PHPStorm Setup for Magento 2

As a Magento developer, you are dealing with a complex code-base that you have to navigate through. That is why it is useful to have an IDE (Integrated Development Environment) that helps you write your code and ensure its quality.

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer](https://hourlydeveloper.io/hire-dedicated-php-developer/ "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website? **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")** has always been an industry leader for companies and business owners looking to hire...

Top Magento Development Companies | Magento Developers | Australia | TopDevelopers.co

An extensively researched list of expert Magento developers with ratings & reviews to help finds the best custom Magento development companies around Australia.

PHP Website Development

Skenix Infotech is a leading PHP Web Development Company that helps companies get results with industry best practices. Get affordable PHP Development Services.