Netbeans 7 and Yii 1.1.7

Guys,

I am new to yii. I installed netbeans 7 but cannot seem to locate yii code completion under plugins?

How do i activate yii code completion under netbeans 7 ?

Hi, and welcome to the Yii community. :)

What did you try?

Did you read the guide in our wiki about Netbeans and Yii?

Netbeans guide

You can safely ignore all that test stuff - I did, because I’m not testing my code. :P

What’s important is the section about code completion, especially the bit where you ignore yiilite.php.

do u think that NetBeans is the best IDE to work on Yii? I suggest notepad++ !

Ok, will ignore the testing part.

notepad++ … why ?

for many reasons, it is

1- light

2- easy to use

3- small and smart

4- supports PHP and HTML and CSS codes

5- supports Unicode & UTF-8 & BOM & etc

6- great code editor

what else do u expect from it? Just it doesn’t have a built-in Apache !

Netbeans runs on Linux

Code completion is automatic, once you put the framework folder in the path or just move its directory under /protected folder

:)

regards!

(AFAIK) Notepad++ is not an IDE, but an editor, even with some extra features.

An IDE is much more. To me, besides very powerful code completion and lots of other less important features, the ability to debug your code is very important. Yes, this has a price: Netbeans, and Eclipse even more, are quite slow and resource consuming on your development machine. Yet, I cannot think about developing in anything else. Among the two, Netbeans and Eclipse, I find the former quicker but slightly less featureful/powerful than the latter. I use Netbeans for my PHP development.

Boaz.

To get the framework classes auto completed:

  • Go to the projects view in NB (Netbeans).

  • Right click on the project -> properties.

  • Select "PHP Include path" -> "Add Folder"

  • Now add the folder in which the framework itself sits. I added only the subfolder titled "framework" of the opened package, skipping the "demos", "requirements" etc stuff.

** Also, I recommend opening another project in NB for the framework files themselves (the same folder that you’ve just “included”) for again easier navigation/examination of the source code.

We often structure our own projects (at least for development) as:

/ (web root, index.php, etc)

/protected/ (app)

/framework/ (yii base)

Then we have access to yii framework and can also track any customizations that were needed to yii (which does happen, in situations where a feature does not yet exist in Yii, that we patch in and submit upstream).

Of course, for that dir structure, you have to set up .htaccess DENY (or block via nginx config) to be safe.

I think NetBeans is good enough (if not the best IDE,it’s a subjective matter), to work on Yii projects, and I don’t think Notepad++ can be considered an IDE but just a lightweight and powerful text editor. I use Notepad++ only to open large SQL files since it consumes lesser memory and still highlights nicely. I use NetBeans because it is free (no need to crack Zend or any other IDEs), and provides step by step debugging.

Dear sir, you are a troll. :lol:

IDE is IDE and Editor is Editor everone knows it BUT

I just suggested to try notepad++ as a good and fast editor not as an IDE and I never compare np++ with nb or eclipse

Personally I don’t like huge IDEs while a light editor does lots of them for me.

I don’t use Eclipse for the same reason. NetBeans is incredibly light-weight in comparison, which is why I use it.

Being a KDE-using Debian user, I usually use Kate when doing light editing, or Emacs when I need more power.

But this topic is actually about using NetBeans. ;)

Thanks for the information Boaz,

I am also brand new to Yii and wondered about code completion in Netbeans, just to clarify, do you mean after creating a new project say "yiiproject" just add a php include path to the YiiRoot/framework/ folder

yep. that will enable the important code completion for class properties/methods and its very important since almost all your code is inherited classes so you would want to have framework code classes prop/methods auto-completed.

oh, you might need to add following 1 line doc block:


/* @var $this YourController */

right above the line where you use $this since in some view file, netbeans would not know that $this refers to an object of class YourController. This way you tell netbeans about the type and violla! you have code completion there as well.

Thanks! You should add this to the guide: http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects

I’m still on NetBeans 6, has anyone tried if the guide instructions are still valid in NetBeans 7?

I did… :rolleyes: . I’m using NB7.0

i wasn’t aware of this wiki page.

its updated now! :)

Ah great, thanks again Boaz