Book Image

PHP Application Development with NetBeans: Beginner's Guide

By : M A Hossain Tonu
Book Image

PHP Application Development with NetBeans: Beginner's Guide

By: M A Hossain Tonu

Overview of this book

<p>NetBeans has many features that greatly simplify PHP development, and with its several features and great flexibility, PHP developers can become overwhelmed by the IDE's options. This book provides step-by-step instructions that show you how to take control of the environment and make use of these features to make your PHP application development more efficient and productive than ever before.<br /><br />"PHP Application Development with NetBeans: Beginner's Guide" leads you through the crucial parts of PHP programming and shows you how to use the features of NetBeans that will improve your PHP development experience, through clear and easy instructions.<br /><br />The book gets you started with the development environment and tools, and takes you through working on practical projects with a clear focus. With each chapter being mission-critical, the book is a perfect companion to boost your PHP coding productivity and gain experience with even complex projects.<br /><br />The book starts with setting up the PHP development environment and introduces exciting and useful IDE features. You'll learn how to build real life PHP projects such as Facebook like Status Updater and even User Registration, Login &amp; Logout application. Also the book will introduce you with some must know development tools such as debugging &amp; testing tools, source documenter tools, and versioning tools.<br /><br />Working with the NetBeans IDE for PHP development has its own advantages, and this book reassures the purpose. This book is full of illustrations, screenshots, and clear instructions to take your PHP development to a new level and even shows you time-saving tricks and other productivity enhancements.</p>
Table of Contents (16 chapters)
PHP Application Development with NetBeans Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Time for action — creating a Symfony2 project using NetBeans


We will create a new PHP project with the Symfony2 framework support. After the project directory structure is created by the IDE, we will configure our Symfony2 website. So let's go through the following steps:

  1. 1. Create a brand new PHP project in the usual way, and in the step where you are asked to choose PHP Frameworks, check the Symfony2 PHP Web Framework checkbox, as shown in the following screenshot:

  2. 2. As soon as you click on Finish in the New Project Creation dialog box, the IDE generates a new Symfony project and dumps the extracted framework inside. The created project directory may look similar to the following:

  3. 3. Now, point your browser to http://localhost/symfony2/web/config.php (replace symfony2 with your project directory name). The new, Symfony2 project configuration page will look similar to the following screenshot:

    You should see a welcome message from Symfony and maybe a list of problems detected by it. Try to resolve any major environment problems listed under the Recommendations section before continuing.

  4. 4. The Symfony framework provides a website configuration wizard. To enter the wizard, visit the Configure your Symfony Application online link, and configure your database credentials for the application. At this page, you may choose your database driver (MySQL - PDO), update your database information, such as hostname, database name, username, and password, and proceed to the next step.

    You may choose the Bypass configuration and go to the Welcome page link if you have already configured the application.

  5. 5. In the next step, you may generate and update a global secret code (random alphanumeric string) for your web application. This secret code is used for security purposes, such as CSRF protection.

  6. 6. The final step shows a successful configuration message, such as Your distribution is configured! Actually, such a configuration has overwritten the parameters.ini file inside the /app/config/ directory.

  7. 7. Now, point your browser to http://localhost/symfony2/web/app_dev.php/ (replace symfony2 with your project directory name). The new Symfony2 project landing page will look similar to the following screenshot:

What just happened?

We have successfully created and configured a new Symfony project along with demo applications. The fundamental directory structure of a Symfony2 project is described below:

  • app/: This includes the application configuration files, logs, caches, and so on.

  • src/: This includes the project's PHP code and the directory your code will be in. Most likely, there will already be a demo inside it.

  • vendor/: This includes third-party dependencies.

  • web/: This includes the web root directory.

Note

Getting started with Symfony at:

http://symfony.com/get_started

Understanding Symfony directory structure:

http://symfony.com/doc/current/quick_tour/the_architecture.html