Sol
Sol

Reputation: 889

Use PHPDocumentor to create an Eclipse Library

I have an unusual request,

I'm working on PHP 5.3, my IDE is Eclipse and I need help setting a file like the one that comes in default with the php functions, so I can use it for code completion and I can have the documentation on hover.

So basically, I have a library, which I want to pull the declarations for everything (function, classes, etc) and the PHPDoc block, and use them to create a new file, which will be added as a library on Eclipse on the include path. Anyone knows an automatic way to do it?

EDIT: To explain a bit better what I want to do. I want to run a script that will do almost what PHPDoc does, but instead of creating a set of html files after load a file, it will create a copy of the php file which only has the declarations and comments. So that file can be given to the programmers, instead of the full library with source-code.

I though about using the ReflecationClass, by including each file, check the defined class\functions and then writing the new file, but that means that all the includes\requires need to happen in order, something I can't guarantee

Upvotes: 0

Views: 137

Answers (1)

ashnazg
ashnazg

Reputation: 6688

Not sure if this counts as "automatic", but what you describe sounds like it can be roughly accomplished by having this library itself as an open Eclipse project. If your "new code" is in a separate Eclipse project, then you want to list your library project in the new project's Include Path configuration.

In the "PHP Include Path" config popup for your new project, click "Add" and select the library project (it will only be visible here if it is also "open"). You can choose whether or not it should come before the new project on the include path or not by moving things around in the Order tab. I tend to keep my current project listed first, then dependencies afterward, just in case any of my new project's classes take precedence over same name classes in the dependency projects.

An added benefit to this is that when you open your new project, any referenced projects in the Include Path configuration will automatically be opened too.

Upvotes: 1

Related Questions