An Oracle blog about NetBeans for PHP

Create support for your favorite PHP framework

Guest Author

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.

Join the discussion

Comments ( 26 )
  • Michal Tatarynowicz Monday, June 21, 2010

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

  • Tomas Mysik Monday, June 21, 2010

    To Michal Tatarynowicz:

    Yes because NetBeans is written in Java. I will update the blog post.

  • Goran Mišković Monday, June 21, 2010

    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! ;)

  • Tom Monday, June 21, 2010

    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).

  • e.s.t Monday, June 21, 2010

    > 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!

  • Tom Monday, June 21, 2010

    @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".

  • Tom Monday, June 21, 2010

    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.

  • Ricardo Monday, June 21, 2010

    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!

  • learnphp123 Tuesday, June 22, 2010

    To learn php,html,javascript,ajax,mysql,jquery with advanced concepts, you can visit <a href ="http://advancedphptutorial.blogspot.com">http://advancedphptutorial.blogspot.com</a>

  • Denyerec Wednesday, June 23, 2010

    Not a framework, per-se, but how about support for Zencoding? http://code.google.com/p/zen-coding/

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

  • Daniel Dimitrov Thursday, July 1, 2010

    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?


  • Tomas Mysik Thursday, July 1, 2010

    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 netbeans.org [1].



    [1] http://netbeans.org/kb/trails/platform.html

  • Daniel Dimitrov Thursday, July 1, 2010

    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!

  • Said Bakr Tuesday, July 6, 2010

    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.

  • Tom Monday, July 12, 2010

    @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.

  • Tomas Mysik Tuesday, July 13, 2010

    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.

  • Said Bakr Tuesday, July 13, 2010

    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.

  • Tom Tuesday, July 13, 2010

    @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) ;)

  • Tomas Mysik Wednesday, July 14, 2010

    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.

  • Tomas Mysik Wednesday, July 14, 2010

    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.

  • Tom Wednesday, July 14, 2010

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

  • Tomas Mysik Wednesday, July 14, 2010

    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].

    [1] http://platform.netbeans.org/

  • Tom Thursday, July 15, 2010

    @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.

  • Goran Mi&scaron;kovi&#263; Thursday, July 15, 2010

    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]?

    [1] http://sourceforge.net/projects/php-java-bridge/

    [2] http://java.sun.com/developer/technicalArticles/scripting/languages/

  • Tom Thursday, July 15, 2010

    @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.

  • Goran Miskovic Thursday, July 15, 2010

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

    Further on: http://quercus.caucho.com/

    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."

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.