Book Image

Laravel Application Development Cookbook

By : Terry Matula
Book Image

Laravel Application Development Cookbook

By: Terry Matula

Overview of this book

When creating a web application, there are many PHP frameworks from which to choose. Some are very easy to set up, and some have a much steeper learning curve. Laravel offers both paths. You can do a quick installation and have your app up-and-running in no time, or you can use Laravel's extensibility to create an advanced and fully-featured app.Laravel Application Development Cookbook provides you with working code examples for many of the common problems that web developers face. In the process, it will also allow both new and existing Laravel users to expand their knowledge of the framework.This book will walk you through all aspects of Laravel development. It begins with basic set up and installation procedures, and continues through more advanced use cases. You will also learn about all the helpful features that Laravel provides to make your development quick and easy. For more advanced needs, you will also see how to utilize Laravel's authentication features and how to create a RESTful API.In the Laravel Application Development Cookbook, you will learn everything you need to know about a great PHP framework, with working code that will get you up-and-running in no time.
Table of Contents (18 chapters)
Laravel Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting up your IDE to autocomplete Laravel's namespaces


Most IDEs (Integrated Development Environment) have some form of code completion as part of the program. To get Laravel's namespaces to autocomplete, we may need to help it recognize what the namespaces are.

Getting ready

For this recipe, we'll be adding namespaces to the NetBeans IDE, but the process will be similar with others.

How to do it...

Follow these steps to complete this recipe:

  1. Download the following pre-made file that lists the Laravel namespaces: https://gist.github.com/barryvdh/5227822.

  2. Create a folder anywhere on your computer to hold this file. For our purposes, we'll add the file to C:/ide_helper/ide_helper.php:

  3. After creating a project with the Laravel framework, navigate to File | Project Properties | PHP Include Path:

  4. Click on Add Folder… and then add the folder at C:/ide_helper.

  5. Now when we start typing the code, the IDE will automatically suggest code to complete:

How it works...

Some IDEs need help understanding the syntax of a framework. To get NetBeans to understand, we download a list of all the Laravel classes and options. Then, when we add it to the Include Path, NetBeans will automatically check the file and show us the autocomplete options.

There's more...

We can have the documents downloaded and updated automatically using Composer. For installation instructions, visit https://github.com/barryvdh/laravel-ide-helper.