Thursday, March 6th, 2008

To ExtPHP, or to PHP-Ext?

Category: JavaScript, PHP, Sencha

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

PHP-Ext

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

ExtPHP

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();
  8.  
  9. $tabpanel->add(
  10.     array('title'=>'New Tab', 'iconCls'=>'tabs', 'autoLoad'=>
  11.         array('url'=>'extphptest.php?content1'),
  12.         'closable'=>true
  13.     )
  14. );
  15.  
  16. new JsReady(JsWriter::get());

Maybe you guys can join forces? :)

Related Content:

10 Comments »

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

@LFRed

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: http://trac.symfony-project.com/wiki/sfExtjs2Plugin

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)
http://trac.symfony-project.com/wiki/sfExtjsThemePlugin

Comment by lvanderree — March 6, 2008

We all know coolite.com , a tool for asp.net 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:
http://www.davegoodchild.co.uk/library/

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.

Regards,

Dave.

Comment by dlgoodchild — July 29, 2009

Leave a comment

You must be logged in to post a comment.