---
title: "Magento 2: Module Code Generation with Pestle"
description: The Pestle is a new PHP (5.6+) framework for creating and organizing PHP programs into Python like libraries of functions. Currently, Pestle has commands for generating a new module, a new route, a new view/block/layout for that route and many more.
image: https://blog.e-zest.com/hubfs/blog-files/Magento%202%20%20Module%20code%20generation%20with%20Pestle.png
---

[![e-Zest logo\_An accion lab company\_Colour](https://blog.e-zest.com/hubfs/images/Logos%20with%20Tagline/Corporate/SVG/e-Zest%20logo_An%20accion%20lab%20company_Colour.svg "e-Zest logo_An accion lab company_Colour")](https://www.e-zest.com/)

- [WORK](https://www.e-zest.com/our-work)
- [SERVICES](https://www.e-zest.com/our-services) 
    - [Product Engineering](https://www.e-zest.com/digital-product-engineering-services)
    - [Enterprise Data Services](https://www.e-zest.com/enterprise-data-services)
    - [Digital Commerce](https://www.e-zest.com/digital-commerce-services)
    - [Digital Operations](https://www.e-zest.com/digital-operations)
    - [Digital Consulting](https://www.e-zest.com/digital-transformation-consulting-services)
    - [Digital Experience Design](https://www.e-zest.com/digital-experience-design)
- [INSIGHTS](https://blog.e-zest.com/)
- [CAREERS](https://www.e-zest.com/careers)
- [ENTERPRISE DATA SERVICES](https://www.e-zest.com/enterprise-data-services)
- [GENERATIVE AI](https://www.e-zest.com/generative-ai)
- [Healthcare](https://healthcare.e-zest.com)
- [Contact Us](https://www.e-zest.com/contact-us)

- ![Elevating Product Engineering with AI and ML](https://blog.e-zest.com/hubfs/Elevating%20Product%20Engineering%20with%20AI%20and%20ML.jpg)

  [BLOGS](https://blog.e-zest.com)
  
  #### Elevating Product Engineering with AI and ML

  As technology evolves and customer choices broaden, there is an increasing ...

  [Read more](https://blog.e-zest.com/elevating-product-engineering-with-ai-and-ml)
- ![e-Zest – An Accion Labs Company gets Recognition as a Contender in the ISG Provider Lens™ Study on Digital Engineering Services 2024](https://blog.e-zest.com/hubfs/e-Zest%20%E2%80%93%20An%20Accion%20Labs%20Company%20-%20Gets%20Recognition%20as%20a%20Contender%20in%20the%20ISG%20Provider%20LensTM%20Study%20on%20Digital%20Engineering%20Services%202024.jpg)

  [NEWS](https://blog.e-zest.com/news)
  
  #### e-Zest – An Accion Labs Company gets Recognition as a Contender in the ISG Provider Lens™ Study on Digital Engineering Services 2024

  We are delighted to announce that e-Zest – An Accion Labs Company has been ...

  [Read more](https://blog.e-zest.com/news/e-zest-an-accion-labs-company-gets-recognition-as-a-contender-in-the-isg-provider-lens-study-on-digital-engineering-services-2024)
- ![e-Zest Solutions supports Digital Pune Mission](https://blog.e-zest.com/hubfs/blog-files/Digital%20Literacy%20Bus%20e-Zest.png)

  [CSR](https://blog.e-zest.com/csr)
  
  #### e-Zest Solutions supports Digital Pune Mission

  **Pune, India:** e-Zest Solutions, a leading digital technology innovation ...

  [Read more](https://blog.e-zest.com/csr/e-zest-solutions-supports-digital-pune-mission)

- [Work](https://www.e-zest.com/our-work)
- [Services](https://www.e-zest.com/our-services)
- [Insights](https://blog.e-zest.com)
- [Careers](https://www.e-zest.com/careers)
- [Enterprise Data](https://www.e-zest.com/enterprise-data-services)
- [Generative AI](https://www.e-zest.com/generative-ai)
- [Innovations](https://www.e-zest.com/innovations)
- [Healthcare](https://healthcare.e-zest.com)
- [About](https://www.e-zest.com/about-us)
- [Contact](https://www.e-zest.com/contact-us)

- [Blog](https://blog.e-zest.com/)
- [News](https://blog.e-zest.com/news)
- [CSR](https://blog.e-zest.com/csr)

- [![Linkedin Icon](https://blog.e-zest.com/hubfs/icons/linkedin_icon_white.svg)](https://www.linkedin.com/company/e-zest-solutions/)
- [![Twitter Icon](https://blog.e-zest.com/hubfs/twitter-logo-silhouette%20(5).svg)](https://twitter.com/ezest)
- [![Facebook Icon](https://blog.e-zest.com/hubfs/facebook-app-logo%20(4).svg)](https://www.facebook.com/61259256638)
- [![Instagram Icon](https://blog.e-zest.com/hubfs/instagram-logo%20(4).svg)](https://www.instagram.com/ezestsolutions/)
- [![Youtube Icon](https://blog.e-zest.com/hubfs/icons/youtube_icon_white.svg)](https://www.youtube.com/user/ezestcorporate)

[![Go to top icon](https://blog.e-zest.com/hubfs/AA%20Assets/top%20button.svg)](https://blog.e-zest.com/magento-2-module-code-generation-with-pestle#top)

Hit enter to search or ESC to close

Insights

e-Zest members share technology ideas to foster digital transformation.

- [Blog](https://blog.e-zest.com)
- [Whitepaper](https://blog.e-zest.com/whitepaper)
- [Playbook](https://blog.e-zest.com/playbook)
- [News](https://blog.e-zest.com/news)
- [Innovation](https://blog.e-zest.com/innovation)
- [Media Kit](https://www.e-zest.com/media-kit)

# Magento 2: Module Code Generation with Pestle

[Makarand Uparwat](https://blog.e-zest.com/author/makarand-uparwat)  Nov 20, 2018

[Magento 2.0](https://blog.e-zest.com/topic/magento-2-0) [Pestle](https://blog.e-zest.com/topic/pestle)

- <https://www.linkedin.com/shareArticle?mini=true&url=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle&title=&summary=&source=>
- <https://twitter.com/intent/tweet?source=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle&text=Magento%202:%20Module%20Code%20Generation%20with%20Pestle>
- <https://www.facebook.com/sharer/sharer.php?u=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle>
- <https://www.instagram.com/ezestsolutions/?u=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle>

**What is Pestle?**

The Pestle is a new PHP (5.6+) framework for creating and organizing PHP programs into Python like libraries of functions. Currently, Pestle has commands for generating a new module, a new route, a new view/block/layout for that route and many more.

**Installing on Linux**

System requirements

- PHP 5.6+

 Download the latest build using following curl

- `$ curl -LO http://pestle.pulsestorm.net/pestle.phar`
- After download give it an exccute permission  
  `$ sudo chmod +x pestle.phar`
- Now move it to /usr/local/bin/  
  `$ sudo mv pestle.phar /usr/local/bin/pestle.phar`
- Now use command `$ pestle.phar version`. You will able to see the current installed version of Pestle.  
  `pestle Ver 1.4.3`

 After successful installation, you can go on generating a new module using command line.

**Creating a Basic Module**

If you’ve worked on a custom module, you know creating a basic Magento module is straightforward, but it involves many different files. Pestle can handle that boring and repetitive work of creating those files for you.

The first step of a custom module is to create module.xml and registration.php file. To create these file run the following command.

`$ pestle.phar generate_module`

![pestle-1](https://blog.e-zest.com/hs-fs/hubfs/pestle-1.png?width=631&name=pestle-1.png)  
Then enable it using the following command

`$ php bin/magento module:enable Ezest_HelloWorld`  
`$ php bin/magento setup:upgrade`

**Adding the Route & Index Action**

The next step of creating a Magento module is adding a route.  
`$ pestle.phar generate_route`

![pestle-2](https://blog.e-zest.com/hs-fs/hubfs/pestle-2.png?width=631&name=pestle-2.png)  
**Adding a Frontend View Files**  
Now we need to add Magento’s default view files, like XML file, phtml template, and default block/view class.

`$ pestle.phar generate_view`

![pestle-3](https://blog.e-zest.com/hs-fs/hubfs/pestle-3.png?width=600&name=pestle-3.png)  
After running the above command, clear your cache and reload the page. You should see your view’s content.  
  
**Simple Yet Powerful Commands**

It is possible to specify any input as a command argument. What this means is that you could recreate the above module with just three simple commands.  
`$ pestle.phar generate_module Ezest HelloWorld 0.0.1`

`$ pestle.phar generate_route Ezest_HelloWorld frontend hello_world`

`$ pestle.phar generate_view Ezest_HelloWorld frontend hello_world_index_index Main content.phtml`

These above commands will automatically create the required files and folder structure, as shown in below image.  
![pestle-4](https://blog.e-zest.com/hs-fs/hubfs/pestle-4.png?width=345&name=pestle-4.png)  
Hope this helps you to reduce the manual work of creating files of your custom module using Pestle.

- <https://twitter.com/intent/tweet?source=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle&text=Magento%202:%20Module%20Code%20Generation%20with%20Pestle>
- <https://www.facebook.com/sharer/sharer.php?u=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle>
- <https://www.linkedin.com/shareArticle?mini=true&url=https://blog.e-zest.com/magento-2-module-code-generation-with-pestle&title=&summary=&source=>

### Similar Blog

[![How to setup Docker Container for Magento 2](https://blog.e-zest.com/hubfs/How%20to%20setup%20Docker%20Container%20for%20Magento%202.jpg) How to setup Docker Container for Magento 2 Docker is an application that allows us to manage multiple applications in the simplest way in the docker container. Docker ... By Rajesh Rathod Oct 15, 2021](https://blog.e-zest.com/how-to-setup-docker-container-for-magento2)

[Custom Sessions in Magento 2 Sessions play an important role in enhancing the user experience and they also help gather vital stats about the user visits. In ... By Pooja Pardeshi Nov 15, 2018](https://blog.e-zest.com/custom-sessions-in-magento-2)

[![Magento 2 - How to display CMS block in Checkout Sidebar](https://blog.e-zest.com/hubfs/how-to-display-cms-block-in-checkout-sidebar.png) Magento 2 - How to display CMS block in Checkout Sidebar Using CMS blocks, site administrator can easily manipulate content of the vendor. CMS blocks can be used to display promotional ... By Sejal Shah Nov 01, 2018](https://blog.e-zest.com/magento-2-how-to-display-cms-block-in-checkout-sidebar)

[![Code validations using static-review library in Magento](https://blog.e-zest.com/hubfs/code-validations-using-static-review-library-in-magento.png) Code validations using static-review library in Magento **Introduction:**Magento2 comes up with some advance tools and plugins, which are really useful for developers to track some common ... By Shubh Sharma Oct 19, 2018](https://blog.e-zest.com/code-validations-using-static-review-library-in-magento)

## Helping Organizations Thrive in the Digital Age

[Contact Us](https://www.e-zest.com/contact-us)

- [About](https://www.e-zest.com/about-us)
- [Services](https://www.e-zest.com/our-services)
- [Work](https://www.e-zest.com/our-work)
- [Insights](https://blog.e-zest.com/)
- [Healthcare](https://healthcare.e-zest.com/)
- [Accion Labs](https://www.accionlabs.com/)

- <https://www.linkedin.com/company/e-zest-solutions/>
- <https://twitter.com/ezest>
- <https://www.facebook.com/eZest/>
- <https://www.instagram.com/ezestsolutions/>
- <https://www.youtube.com/user/ezestcorporate>

- Dallas
- Detroit
- Hannover
- Vienna
- London
- Pune

 © 2025 e-Zest Solutions

- [Privacy Policy](https://www.e-zest.com/privacypolicy)
- [Cookie Policy](https://www.e-zest.com/cookie-policy)

 Contact us

 Contact us

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.