Create support for your favorite PHP framework

Today, I would like to inform you that we have created a wiki page which could be a starting point for all of you who would like to create a support for your favorite PHP framework (Java knowledge is needed). All the relevant information should be found there, we hope that you will find it useful.


So I need to know Java to create support for my PHP framework? That's not going to happen :/

Posted by Michal Tatarynowicz on June 21, 2010 at 05:14 AM CEST #

To Michal Tatarynowicz:
Yes because NetBeans is written in Java. I will update the blog post.

Posted by Tomas Mysik on June 21, 2010 at 05:17 AM CEST #

Native Java speaker learning PHP language is quite common. On the other hand, native PHP speaker learning Java... Well, that is a challenge.

Nice try Thomas! ;)

Posted by Goran Mišković on June 21, 2010 at 05:34 AM CEST #

For other IDEs all I have to do is add a few configuration and (sometimes) batch files. Development of a complete Java plugin that I have to update with each version of NetBeans? Definitely _not_ implementing.

All one needs to add framework support is a custom button to execute an external application, code-completion/template files and (for some frameworks only) some configuration files for highlighter rules. I already provide these for other editors and it's so easy that I can integrate it in my build process.

Not more - not less. As Michal said: We don't need/want to right our own fancy plugins. Drop that idea - it's not going to happen.

To see how it should be done, check PSPad or ConTEXT. If all you want to do is add a framework, you don't need any more customization than that. 2 files: highlighter rule set, auto-completion list. As an option there are 4 customizable "run" buttons to execute command line calls on the framework. Way to go!

Highlighter rule set may be very simple: 4 categories of keywords, a list of delimiters for blocks and strings. That's it.

Should be enough to get 80-90% of all frameworks out there up and running within days (or at most weeks).

Posted by Tom on June 21, 2010 at 05:40 AM CEST #

> native PHP speaker learning Java... Well, that is a challenge.

No it's not. To the contrary this is a perfect learning trail (as it was for me).
I am though, in very good position as my favourite frameworks are Zend and Symfony, and they are already supported :)
Thanks to all NetBeans developers for the most cool IDE I've ever worked on!

Posted by e.s.t on June 21, 2010 at 05:42 AM CEST #

@e.s.t. It's not that Java is difficult - it isn't. It's just time-consuming.

There is so many other work to do that I have no time to write Java plugins.

Instead it must fit in the existing infrastructure. Currently it doesn't - so it won't be done.

A "community" of PHP programmers is probably not going to do write Java plugins either.

Providing support for a dozen other editors through a build script is as simple as writing a set of XML transformations (or equivalent PHP files) and run them in a batch process.
The result is a new directory with 1 ZIP file per IDE ready to be shipped.

Need support for a new IDE? No problem: add your transformation files and you are ready to go within hours.

There is no reason to make an exception just for NetBeans. We are not doing anything fancy in these files. Just auto-completion, command line calls and keyword lists.

It's a de facto standard that derives from other editors and what they can and can't do. They all require the same set of information (even though the file formats may vary). We don't care if NetBeans can do more, since this is all we need to support about 80% of all frameworks out there.

Of course you can't solve any possible issue this way - but that's never been the intention. We don't need it to be perfect. We just need it to be "good enough".

Posted by Tom on June 21, 2010 at 06:33 AM CEST #

For your convenience, here is how other IDEs/editors solved the problem. I also added comments, to state if this feature is frequently used by frameworks and if it is supported by common IDEs/editors.

This is what we usually provide as input via configuration files.

Highlighter configuration files: (only some frameworks need their own highlighter files, but all editors I know support this feature)

These files usually include the following information.

Title: string
Description: string
Filefilter: string[]
HelpFile: url
CaseSensitive: bool
MultilineStrings: bool
KeyWords1: string[]
KeyWords2: string[]
KeyWords3: string[]
KeyWords4: string[]
StringBegChar: char[]
StringEndChar: char[]
BlockBegStr: char[]
BlockEndStr: char[]
IdentifierBegChars: char[]
IdentifierChars: char[]
NumConstBegChars: char[]
NumConstChars: char[]
LineComment: string[]
BlockCommentBeg: string[]
BlockCommentEnd: string[]

These editors obviously use these settings as input for some generic Lexer.

Available settings in highlighter files may slightly vary. But basically it's all the same throughout editors. Thus files are easy to adapt/convert.

Help files and manuals: (often required, rarely supported)

Some editors pop up an url to an online manual or local help file when you hit F1-key. Some even allow parameters to be added to the call (like the word under the cursor) to provide context sensitive help.
The URL is usually included in the highlighter file.

Auto-completion: (most frameworks need it, supported by many editors)

Configuration files use at least the following information:

[keyword1 | description]
auto-complete template

[keyword2 | description]
auto-complete template


Again, the syntax may vary. But the contents are pretty much identical.
I know NetBeans already has similar XML files for code-templates. Perhaps you could use those.

Note that most editors do not distinguish between auto-completion and code-templates. So there usually are no separate files for that.
You could mimic this behavior to quite instantly add auto-completion to arbitrary file types.
Good enough for almost any framework.

Command line calls: (some frameworks with CRUD-page generators use it, most editors support it more or less)

Usually provided with some basic parameters that may be included.
- file/directory name/extension with/out path
- current line/column
- word under cursor
- named parameter (is included in input dialog)

php crud.php dir=%p database=%?database table=%?table

This might pop up an input dialog asking for "database" and "table", then executes the command line call, while providing the currently selected directory.

For most editors this is an environment setting. Users have to add it by hand, or import the settings to their editor from a file.
Personally I believe this behavior isn't perfect and could be improved to be more convenient.

There: I hope it helps.

Posted by Tom on June 21, 2010 at 02:12 PM CEST #

It's nice. Besides that I already find pretty good developing CodeIgniter projects with Netbeans, it would be good to have a proper support. Continue your great work guys!

Posted by Ricardo on June 21, 2010 at 07:37 PM CEST #

To learn php,html,javascript,ajax,mysql,jquery with advanced concepts, you can visit <a href =""></a>

Posted by learnphp123 on June 23, 2010 at 01:43 AM CEST #

Not a framework, per-se, but how about support for Zencoding?

I know there's a workaround semi-implementation, but to have it fully supported would be superb.

Posted by Denyerec on June 23, 2010 at 05:55 AM CEST #

Hey guys,
I'm not a java developer, but I want to try this.
I followed the turorial, but i'm stuck at
tools->netbeans platform->add platform

I've downloaded netbeans 6.9 source filese, but I'm unable to add them. Neither the zip or the unzipped folder. Any ideas what I do wrong?

Posted by Daniel Dimitrov on July 01, 2010 at 04:14 AM CEST #

To Daniel Dimitrov:
You need to add a platform, not its sources (sources can be attached later to the platform). Have a look at any tutorial on [1].


Posted by Tomas Mysik on July 01, 2010 at 04:24 AM CEST #

Hey Tomas,
Thank you for your fast reply.
under tools I can see netbeans platform - I've managed to add this.

What I cannot do is attach the sources that I've downloaded to the platform.

P.S. now i see it - I have a mistake in my first comment "tools->netbeans platform->add sources" of course and not "tools->netbeans platform->add platform". Sorry about this!

Posted by Daniel Dimitrov on July 01, 2010 at 04:53 AM CEST #

I think this is very good idea. We regard a wide community around the world and the probability to find a Java developer who consider PHP and have some extra time is not as little as to be neglected.

Some of IDEs that appear to offer CakePHP or any other framework support, in fact, it is not real support, it is just something like dictionary listing for the framework API which acts as auto complete list. Of Course, we need any future support by NetBeans for CakePHP to go beyond this and offer smart and full support.

Posted by Said Bakr on July 06, 2010 at 03:11 PM CEST #

@Said Yes, if you happen to have broad community-support for Cake this is great.

But I'm building a business-scale framework for back-offices. Possibly will implement Data-Warehouse support some time soon as well, to integrate smoothly with Pentaho BI-Server and Kettle ETL (aka Pentaho Data Integration).

Now these are not typical features demanded by a broad public community.
If you are building a bike-shed, everybody gathers to tell you which color to paint it. But if you are building a nuclear reactor, they will leave you alone.

So: who is meant to implement support for NetBeans then? I guess none will.

We are having a small community of users, who wish to generate high business value from the software. But the vast majority are consumers, not implementors.

If we compare business value vs. story points for user stories, NetBeans support and Data-Warehouse support match in story points, but DWH support has a much higher business value. With limited resources, guess who wins ;)

Do you think companies like Pentaho will ever introduce a cube-builder or support for Data-Warehouses to NetBeans this way? I don't think so.

Posted by Tom on July 13, 2010 at 01:27 AM CEST #

To Tom:
Yes, to write support for PHP framework is meant mainly for frameworks with larger community - we simply cannot support (and maintain) all the possible frameworks.
OTOH, if you really have a look at sources of e.g. Symfony module, you will realize that it's not so complicated (about 4 thousands lines in the current trunk including licenses); I wrote basic support for my own PHP framework in about 2 or 3 hours.

Posted by Tomas Mysik on July 13, 2010 at 02:37 AM CEST #

To Tomas Mysik,

So, the question is: how to encourage people, groups or even companies to adopt such project?

For this approach I may suggest some kind of advertisement. Who could able to build native support for CakePHP in netbeans will have some banners and ads over NetBeans Website and CakePHP website.

Posted by Said Bakr on July 13, 2010 at 02:45 PM CEST #

@Tomas If it's all that easy, why don't you just write a generic framework plugin that takes 1 or 2 XML files for configuration and be done with it.

No one ever asked for more then to be able to call a few command line scripts (or Ant file) and add some templates (for code or files) ;)

Posted by Tom on July 13, 2010 at 05:07 PM CEST #

To Said Bakr:
Well, IMHO if you want it, you can do it. That's all. We are not pushing anybody but of course, OTOH our resources are limited and we simply cannot support (and maintain) every possible framework on the world.

Posted by Tomas Mysik on July 14, 2010 at 04:04 AM CEST #

To Tom:
Simply not everything can be done/specified in (static) XML. Also, extending NetBeans via XML is perhaps really not a good way to go.

Posted by Tomas Mysik on July 14, 2010 at 04:07 AM CEST #

@Tomas why not? Others already do it. Where's the problem? Let's see if we can work it out.

Posted by Tom on July 14, 2010 at 07:57 AM CEST #

To Tom: (1) There's no way to specify dynamic things in XML; (2) NetBeans is a Java platform, extendable via NetBeans modules. More info here [1].


Posted by Tomas Mysik on July 14, 2010 at 08:18 AM CEST #

@Tomas I already know and I simply don't care. PSPad is written in Delphi and they can. ConText and Notepad are written in C++ and they can.
Some even have an easy to use macro recorder that get's the job done.

Is see no reason why Java should be unable to use XML to configure the name of a file that should be run on the command line when you push button X.

And again: we simply don't need any more than such a button to run our external PHP scripts that will do the job just fine.

Posted by Tom on July 15, 2010 at 04:47 AM CEST #

I am not sure that I am throughly following your discussion, but if it is about dynamically getting information from PHP in xml format did you consider PHP/Java bridge [1] and/or scripting with Java [2]?

Posted by Goran Mišković on July 15, 2010 at 05:29 AM CEST #

@Goran Nope - it's the over way around. Calling some scripting from Java.

Let me wrap up the previous discussion for you:

Basically what I'm asking for is a generic plugin that does nothing more than providing a fixed set of button, that on-click do a command line call (to PHP, Python, Ant ... whatever). And I wish to provide a XML file to tell what the button should do: containing the command line call and a set of parameters.

(Why? Because: Most PHP frameworks already have a command line interface you may use to run their CRUD-page generator, install modules, or anything else the framework can do. And if you don't have it yet: adding a CLI written in PHP, that you may use from a Linux console, or integrate in any IDE - not just NetBeans - is easy to do in ~100 lines of code and always a good idea.)

I would like to bundle this XML with a set of configuration settings (like code-templates) and optionally an URL to some documentation.

My thesis is: this should already be enough to integrate basic support for most PHP frameworks - with virtually no need for any Java coding at all.

As Tomas Mysik stated earlier: his contra-thesis is, that such "very basic" support is not wanted. He suggests that you should either have full support, bundled in a separate Java plugin, or none at all.
As he pointed out: if smaller frameworks where not able to write and maintain such plugin, then there should be no support (not even basic support) in NetBeans at all.

Posted by Tom on July 15, 2010 at 07:21 AM CEST #

@Tom: I thought it is that way around: PHP/Java bridge isn't one way bridge, it works both ways ;)

Further on:

IMHO, the key to get PHP developers involved is greatly summarized in the following quote from the article mentioned above[2]: "The synergy between the Java platform and scripting languages produces an environment in which developers and end users can collaborate to create more useful, dynamic applications."

Posted by Goran Miskovic on July 15, 2010 at 10:08 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blogs is written by NetBeans developers who contribute to the PHP support mainly.


« April 2014