Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Magento 2 Development Cookbook

You're reading from   Magento 2 Development Cookbook Over 60 recipes that will tailor and customize your experience with Magento 2

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785882197
Length 304 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Upgrading from Magento 1 FREE CHAPTER 2. Working with Products 3. Theming 4. Creating a Module 5. Databases and Modules 6. Magento Backend 7. Event Handlers and Cronjobs 8. Creating a Shipping Module 9. Creating a Product Slider Widget 10. Performance Optimization 11. Debugging and Unit Testing Index

Using an IDE

Writing good code starts with a good development environment. An Integrated Development Environment (IDE) is the main part of a good development environment. NetBeans is a free and open source PHP editor that can be used for Magento development. In this recipe, we will set up a Magento 2 project in NetBeans.

Getting ready

Install the latest version of NetBeans IDE on your computer. You can download it from the following URL:

https://netbeans.org/downloads/

For PHP development, you need to download the HTML5 & PHP bundle.

How to do it...

  1. To create a new project, open NetBeans and navigate to File | New Project.
  2. A window like the one in the following screenshot will appear on your screen. Click on PHP and PHP Application with Existing Sources.
    How to do it...
  3. Click on Next and configure the following settings:
    • Source Folder: This field is set to the location of your Magento code (like /var/www/html/magento2/)
    • Project Name: The NetBeans project name is entered in this field
    • PHP Version: This field is set to PHP 5.5
    • Default Encoding: This field is set to UTF-8
  4. In the next screenshot, you can see how everything is configured:
    How to do it...

    Tip

    When you are working with a version control system like GIT, it is recommended that you check the checkbox. Put NetBeans metadata into a separate directory. If not checked, a .nbproject folder is created in your Magento root, and you don't want to have that folder in your version control system. Another possibility is to add the .nbproject folder in the .gitignore file.

  5. Click on Next and configure the final settings:
    • Run as: If you are developing on a local PC, choose Local Web Server
    • Project URL: The URL of your website
    • Index file: Set this to index.php

    The settings are shown in the following screenshot:

    How to do it...
  6. Click on the Finish button and your NetBeans project is ready. You can now start developing.

There's more...

In this recipe, we used the free code editor NetBeans, but there are also some other good alternatives on the market, such as:

  • PHPStorm
  • Eclipse with PDT (PHP Development Tools)
  • Zend Studio
You have been reading a chapter from
Magento 2 Development Cookbook
Published in: Dec 2015
Publisher:
ISBN-13: 9781785882197
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image