Book Image

Magento Extensions Development

By : Jérémie Bouchet
Book Image

Magento Extensions Development

By: Jérémie Bouchet

Overview of this book

Magento has been revealed as the best and the most popular open source e-commerce platform in the world, with about 250k+ online stores. Magento 2 is the most recent version of this awesome toolset: every new and modern development techniques are used to offer a real modular approach and powerful architecture. The book will support you in the writing of innovative and complex extensions. Starting from the beginning, we will cover how to set up a development environment that allows you to be really efficient in your functionality writing, including GIT registering and many other development tools. We then move on to provide a large overview of the best practices to scale your module in a high-load environment. After these foundations, you will see how to use test driven-development (TDD) and unit tests to handle your code. We then build a complex extension together, step by step, and internationally-ready. Next, you will find out how to protect the users’ data. Finally, we will take a look a publishing the extension on the new Magento Connect marketplace and how to protect your intellectual property. After you read this book, you will know everything you need to know to become an invaluable extension editor, whether it is for your customers’ needs or for your own requirements.
Table of Contents (16 chapters)
Magento Extensions Development
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

The book will support you in the writing of innovative and complex extensions. Starting at the beginning, this book will cover how to set up a development environment, such as GIT registering and many other development tools, which allows you to be really efficient in your functionality writing. We will then move on to a broad overview of the best practices for scaling your module in a high-load environment. After these foundations, we will see how to use Test-Driven Development (TDD) and unit tests to handle our code. We will build a complex, international-ready extension together step by step. Next, we will see how to protect the final user's data.

Finally, we will see how to publish the extension to the new Magento Connect marketplace and protect your intellectual property.

After reading this book, you will have learned everything you need to become an invaluable extension editor, whether it is for your customers' needs or for your own requirements.

What this book covers

Chapter 1, Introduction to Extension Development, will discuss the need for complex extensions in Magento Marketplace. We will discover that marketable extensions fulfil a complex purpose and begin to write the foundations of our extension.

Chapter 2, Deeper Extension Development, continues to develop our extension and add some backend capabilities.

Chapter 3, Best Practices and Scaling for the Web, covers the creation of a new product type. We will design and study all the techniques used to speed up our code and think about security first.

Chapter 4, Magento and Test-driven Development, will discover TDD and how Magento handles PHPUnit tests in order to guarantee your customers the best extension.

Chapter 5, Internationalization, will talk about how to localize our module's contents and functionalities.

Chapter 6, Optimizing for Speed and Measuring Conversion Rates, will concentrate our efforts on performance: how to measure the speed and resources the code uses and what impact we can have on speed.

Chapter 7, Module Creation Etiquette, covers how to ensure that you will provide the best trustworthy extension in the market.

Chapter 8, Optimization for Teamwork Development, will cover the basics of project sharing and how to speed up development in a small or big team.

Chapter 9, Magento Marketplace, will provide information on how to publish the code on Magento Marketplace and what to know to ensure that your extension will be validated.

What you need for this book

As a Magento developer, you already have a local web server such as Apache or Nginx and a database server such as MySQL. The book will discuss and explain all the other tools you will need for this book.

Who this book is for

If you want to write a specific customization or a large, new, and full-featured extension to Magento 2, this book is intended for you. You must be an intermediate-to-professional-level developer in PHP to appreciate this book.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Create a Helper class of the extension by adding the following code into the Helper[extension_path]/Helper/Event.php"

A block of code is set as follows:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Blackbird_TicketBlaster" setup_version="1.0.0" />
</config>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<router id="standard">
<route id="events" frontName="events">
<module name="Blackbird_TicketBlaster" />
</route> 

Any command-line input or output is written as follows:

php bin/magento module:enable
php bin/magento setup:upgrade

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can clone the repository of the created extension, which is available at https://bitbucket.org/blackbirdagency/ticket-blaster.

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Magento-Extensions-Development. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/MagentoExtensionsDevelopment_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.