Click here to Skip to main content
15,911,327 members
Articles / All Topics

Setup Netbeans for Zend Framework Development

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
2 Dec 2011CPOL4 min read 24.8K   1   1
Setup Netbeans for Zend Framework Development

If you want to work with Zend Framework, there really isn't too much more setup needed than a regular PHP site, especially if you use the built in zf.bat tool. Doing this, a developer can have a functioning application skeleton up within a couple minutes, not including the time used to download Zend Framework. Then the developer is ready to start working on their new app using their favorite code editors.

Me though, I prefer working in an IDE. I know that this greatly damages any 'Elite' status I may have, but I do think, if used well, an IDE can increase the productivity of a developer. I am extremely biased though, in school, after some fun in text editors, we quickly moved to Netbeans for Java development, and I work in .NET full time for a living; and I have yet to meet an ASP.NET developer who could work as well with or without Visual Studio.

Outside of .NET, I prefer to program using Netbeans. It has language support out there for the big open source languages: Java, PHP, Ruby, and more. The most recent version of Netbeans has really ramped up its PHP support. It now has tooling for Zend Framework built in that rivals the tooling of Zend Studio, but Zend Studio has a bit of a price tag. I encourage PHP developers in the wild to give Netbeans a try and here I present the steps needed in doing so.

Step 1: Get Zend Framework (if you don't have it already)

The first thing you need to do is get the Zend Framework files. Luckily Zend Framework installs with PHP now, so this step can be skipped. If you don't have the files, or would like to get a more up to date version, go here and download your package of choice. I suggest just downloading the zip of 'Zend Framework 1.11.0 Full' as I'm not interested in using Zend Server since I already use Apache and I'm just wanting the framework and not things like the Dojo Toolkit.

Step 2: Put ZF on Your Include Path

The next thing you need to make sure to do is put the Zend Framework Library on your include path. To do this, pop open your 'php.ini' file and find the line that reads:

PHP
'include_path = ".;C:phpincludes"'

I run a Windows system, thus the 'C:'. On a Unix system, it would look like:

PHP
'include_path = ".:/php/includes"'

Now tag a ';' after includes and type in the path to the 'library' folder of your zend framework location. In my case, my 'include path now reads:

PHP
'include_path = ".;C:phpincludes;C:phpZendZendFrameworklibrary"'

Now restart Apache (or whatever server you are using) to apply these changes.

Step 3: Point Netbeans to the zf.bat

If you haven't already gone ahead and downloaded/installed Netbeans, be sure to download a version that has the PHP feature set. After you have netbeans up and running, you'll need to let Netbeans know where your ZF stuff is. To do this, you'll need to go to the tools menu, and click on options. Once the options screen pops up, click on the PHP icon to bring up all the PHP related settings. You should now be able to see a tab for 'Zend'; click it. You should now see something like this:

You'll want to browse and find your zf.bat file and than click the 'Register Provider' button. Once you've done this, Netbeans can execute ZF commands for you.

Step 4: Setting a Hot Key for the ZF Commands?

???If you want to take full advantage of the new Netbeans ZF features, you will want to set a shortcut to open the ZF commands window. To do this, go back to Tools->Options and go to the Keymap settings. Type 'Zend' in the search box and the 'Zend: Run Command..' option should be there. Set the shortcut to 'Alt+Z' or something similar. Now you can press 'Alt+Z' when working on your ZF projects and see something like this:

Step 5: Creating Your Zend Project

Now go ahead and create your new ZF Project. You just created a new php project, but be sure to enable the Zend Framework setting during the project creation process.

Step 6: Setup Your Host Files

The very last thing you need to do to really get started on your ZF app is to set up your host files. To do this, you need to modify 2 files - your 'host' files and Apache's vhost settings, be they in the main apache config or in a separate vhost file. In the host file, add the customary '127.0.0.1 zf-test.com' where zf-test.com is the name for your new app on your local server.

Next go into your servers vhost settings and insert these lines:

HTML
<script src="https://gist.github.com/1176213.js?file=vhost.xml"></script> 

In my case, my app lives at 'C:webrootzf-test'.

Step Last: Really This is the Last Step!

Now restart your server and point your browser to the 'hostname' you set up (in this example, 'zf-test.com', and you should see this screen:

If you see this screen, you have successfully setup your app and can now move on to actually developing your app.

Happy coding!

If you have any questions, feel free to either leave a comment our use my contact form on the contact page.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Element Fusion
United States United States
I am a web developer for Element Fusion living in Oklahoma City, OK. I've been developing in .Net web technologies since the summer of 2009. I enjoy working in Asp.Net MVC along with tinkering with other new web technologies.

Comments and Discussions

 
Questionhost file and vhost file Pin
Member 249821227-Jun-12 10:14
Member 249821227-Jun-12 10:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.