Thursday, March 6th, 2008

To ExtPHP, or to PHP-Ext?

Category: JavaScript, PHP, Sencha

I got emails on the same day from two developers letting me know about ExtJS wrappers for PHP.


First, Sergei Walter Guerra told me about PHP-Ext “an open source widget library written for PHP 4 and 5 to empower the UI Layer.”

The API looks like this:

  1. echo Ext::onReady(
  2.     Javascript::stm(ExtQuickTips::init()),
  3.     Javascript::assign("data",Javascript::valueToJavascript($myData)),
  4.     //Javascript::valueToJavascript($myData),
  5.     $store->getJavascript(false, "ds"),
  6.     $italicRenderer,
  7.     $changeRenderer,
  8.     $pctChangeRenderer,
  9.     $colModel->getJavascript(false, "colModel"),
  10.     $gridForm->getJavascript(false, "gridForm")
  11. );
  13. $gridForm = new ExtFormPanel("company-form");
  14. $gridForm->Frame = true;
  15. $gridForm->LabelAlign = EXT_FORM_LABEL_ALIGN_LEFT;
  16. $gridForm->Title = "Company Data";
  17. $gridForm->BodyStyle = "padding: 5px;";
  18. $gridForm->Width = 750;
  19. $gridForm->Layout = EXT_CONTAINER_LAYOUTS_COLUMN;


Then Chris Ravenscroft came to me to announce ExtPHP:

“It is something that I had to think about in my day job, because my team is migrating to PHP for web development and I believe that we simply do not have enough time for them to learn JavaScript’s intricacies, I needed to be the one person who would have to wrestle JavaScript when problems happened. I therefore needed a way to insulate them from the gory details, which is why I created ExtPHP.”

The API looks like this:

  1. $cfg = new Ext_Viewport_Config();
  2. $viewport = new Ext_Viewport(
  3.     $cfg->
  4.         layout('border')->
  5.         items(array($actionpanel, $tabpanel->name()))
  6. );
  7. $viewport->jsrender();
  9. $tabpanel->add(
  10.     array('title'=>'New Tab', 'iconCls'=>'tabs', 'autoLoad'=>
  11.         array('url'=>'extphptest.php?content1'),
  12.         'closable'=>true
  13.     )
  14. );
  16. new JsReady(JsWriter::get());

Maybe you guys can join forces? :)

Posted by Dion Almaer at 8:54 am

3.4 rating from 148 votes


Comments feed TrackBack URI

Although these kinda Projects are great i still feel that you end up restricting the power of ExtJS.

It took me just short of 48hrs to get to grips with ExtJS and I hate JavaScript :) but ExtJS has made me grow to love it.

Comment by Phunky — March 6, 2008

Check out that syntax. Is that any easier than javascript itself?
Time for a paradigm shift towards simplicity and semantics.

Comment by LFReD — March 6, 2008


It might not be easier then javascript syntactically, however it does allow the developer to keep their code organized in a single location and language. I’ve been working on a php/Extjs project for some time now, and have thought about doing this myself (creating a php wrapper class).

i’ll have to look at exactly how these classes are implemented, but it might be useful. Also it will help to a AJAX project form less skilled developers who dont know how to code in javascript or can’t get a handle of an event driven, functional language.. so until i can hire the developers i’ll be taking a look at this project.

Comment by 0xception — March 6, 2008

For Symfony (the PHP5 Framework ;-) ) there is also a nice ExtJS wrapper-plugin.

You can check it out at:

it can be used with a symfony ExtJS-theme plugin which transforms the default admin-CRUD-pages from Symfony to ExtJS powered ones (although this is still work in progress)

Comment by lvanderree — March 6, 2008

We all know , a tool for to graphically use ExtJs widgets without javascript, but It’s generating javascript.
I believe some one must start working on a plugin for eclipse to add the same functionality as coolite, so there’s no need for a wrapper and also we won’t hand code some thing related to UI, but we’ll use them this way easily.

Comment by phpcs — March 6, 2008

This wrappers like pQuery, ExtPHP will degrade performance vs clean JS. And destroy all business-logics. No reason to use it, only for learning “wrapping” =)

Comment by Luerssen — March 7, 2008

I agree with Luerssen.
But how nice Ext for admin side!

Comment by Snowcoredotnet — May 8, 2008

I’d completely disagree with Luerssen, that type of argument is like saying don’t code C++ cause the generated binary is degraded compared to coding pure assembler – additionally ALL business-logics should be implemented server, doing anything remotely business critical client side is asking for problem!

Comment by EViL — June 6, 2008

I think a nice blend of wrappers and JS makes for a better development environment. I love EXTJS and continue to use it every day in development but I find that I need to dynamically generate JS code based on business logic. This is hard to do in EXTJS when you have a large code base and a very dynamic business logic setup. Most of the development we do the EXTJS is not static and the use of a wrapper class makes for a cleaner code base.

Mostly I use the Wrapper for AJAX classes where PHP preforms the server back-end.

Comment by georgeblackjr — August 15, 2008

I see this is an old post, however I thought I’d share another alternative which is in development.

I’ve been developing this, to reduce the amount of code required to create a UI and to drop the idea of using onReady and stuff like that as seen in PHP-Ext …
A sample can be seen here:

I’ll be aiming to complete this and get it out there for folk to try….The grid stuff has been simplified further than what is currently there.



Comment by dlgoodchild — July 29, 2009

Leave a comment

You must be logged in to post a comment.