Saturday, April 7, 2012

NetBeans 7.1.1 adding a PHP library to a Project

One of the features I really appreciate about using an IDE when programming and NetBeans in particular is code-completion. I have a terrible memory for all of the functions in PHP and even worse for all of the additional libraries I use while programming such as the AWS SDK. Thankfully, NetBeans makes it pretty easy to add a new PHP libraries. The next couple paragraphs will walk you through how to it. I created this tutorial using NetBeans IDE 7.1.1 on Ubuntu so your experience may be slightly different depending on your NetBeans version and OS.

First, put the library in a folder either on its own or with other libraries you want to use. I like putting them in their own folders so I can pick and choose which libraries I want to use for a particular project. Next, in NetBeans, right-click on the project you want to add the library to. Select “Properties” from the context menu. In the “Project Properties” menu select the “PHP Include Path” category. Still in the “Project Properties” menu click “Add Folder”. A file browser dialogue will appear, from there navigate to and select the folder containing the library you want. Once the folder is selected press “OK”.

Now you should see the selected folder in the “PHP Include Path”. Finally click “OK”. At this point there may be a short pause while NetBeans scans the library. After which you’ll be able to use auto-completion for all of the classes and functions in the library. Awesome.

No comments:

Post a Comment