Posted by: Chris Ravenscroft 5 years, 3 months ago

(55 comments)

ExtPHP LogoIt 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.
As you may have guessed from subtle hints, such as this entry's 12-feet tall header, ExtPHP creates a PHP wrapper for ExtJS.

ExtPHP In ActionI noticed, at dzone.com, that the last time someone created a wrapper for JavaScript, many readers complained about how intrusive his approach was. Well, be assured that ExtPHP does not foil ExtJS' non-intrusive take. Of course, with ExtJS itself, it's up to the developer to decide what kind of style they wish to adopt, and ExtPHP follows suit.

ExtPHP Doc ScreenshotI guess the introduction I wrote in ExtPHP's documentation explains fairly clearly what the idea is: "ExtPHP is a wrapper for ExtJS. This is version 0.1, so I expect that a lot of things can be improved upon and your feedback is greatly appreciated. ExtPHP can be used to write both intrusive and non-intrusive Javascript, just like ExtJS itself. Use it responsibly. One of the many advantages of this design is that unknown/misspelled/misused methods are detected in your PHP editor rather than forcing you to debug your JavaScript code in your web browser. "

Documentation? Indeed, I took some time to write a much-needed PDF document. Let me know how I can improve it, I am sure that you will find it lacking - because it is.

Anyway, I am releasing this as a "Technology Preview" and I will greatly appreciate your help beta-testing it.

Cheers.

Download

Current rating: 5


Comments

  • guebreg 5 years, 3 months ago

    Hi , just to warn u about ur link : hhttp....

    Link / Reply
    • Comment deleted 6 months, 3 weeks ago

    • Comment deleted 6 months, 3 weeks ago

    • Comment awaiting approval 5 months, 2 weeks ago

    • Comment awaiting approval 5 months, 2 weeks ago

    • Comment awaiting approval 5 months, 1 week ago

    • Comment awaiting approval 4 months, 3 weeks ago

    • Comment awaiting approval 4 months, 2 weeks ago

    • Comment deleted 2 months, 4 weeks ago

    • Comment awaiting approval 2 months ago

    • Comment awaiting approval 2 months ago

    • Comment awaiting approval 1 month, 4 weeks ago

    • Comment awaiting approval 1 month, 3 weeks ago

    • Comment awaiting approval 1 month, 3 weeks ago

    • Comment awaiting approval 1 month, 3 weeks ago

    • Comment awaiting approval 1 month, 2 weeks ago

    • Comment awaiting approval 1 week, 2 days ago

  • Donald 5 years, 3 months ago

    Any thought on doing this with jQuery?? I see you are migrating to PHP can I suggest you take a look at the Andromeda Database Framework. Its a great framework written in PHP and does not require your to learn php

    Link / Reply
  • admin 5 years, 3 months ago

    Donald: Thanks, I'm going to take a look right away. I haven't found a PHP framework that strikes the right balance, to my taste, yet, so hopefully ADF will be the one! guebreg: Thanks! What a silly mistake. *shakes head*

    Link / Reply
  • Lucian Lature 5 years, 3 months ago

    This is very interesting...good job!....

    Link / Reply
  • Javascript News 5 years, 3 months ago

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

    Link / Reply
  • To ExtPHP, or to PHP-Ext? « outaTiME 5 years, 3 months ago

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

    Link / Reply
  • Benjamin 5 years, 3 months ago

    Hi, thats a great Idea. i hope i will see it evolve, this can become a big thing .. Can you already say something about the compatibility to Ext 2.0 ?

    Link / Reply
  • admin 5 years, 3 months ago

    Benjamin, my testing was performed against Ext 2.0.1 and Ext 2.0.2. Of course a lot more testing will be required to make it a good tool!

    Link / Reply
  • Lorenzo 5 years, 3 months ago

    Hi, I'm testing this great wrapper, but I'm having some problem: I do not find json.php, required in main.php. That file is suppose to be in libs/extphp, where all the generate classes are, but I don't have json.php in that folder. Any idea? What em I doing wrong? Thanks Lorenzo

    Link / Reply
  • Donald 5 years, 3 months ago

    Admin: Were you able to take a look at Andromeda?? If so what did you think, do you have any questions. Until I started using Andromeda (and now a developer on the project), I coded everything from the ground up. Thats been for almost 10 years now. And ever since I started using andromeda I havent thought about going back to hand coding....because with Andromeda if you so choose you can still hand code everything without breaking security or data integrity.

    Link / Reply
  • Merveilles du web 2.0 5 years, 3 months ago

    [...] ExtPHP: An ExtJS Converter/Wrapper for PHP Developers Enregistré dans : ExtJS — Rémi SOUBEYRAND @ 21:31 [...]

    Link / Reply
  • Nexen.net 5 years, 3 months ago

    [...]  ExtPHP (13 visites) [...]

    Link / Reply
  • Glagla Dot Org 5 years, 3 months ago

    [...] (categories: php javascript extjs php4) [...]

    Link / Reply
  • Neves 5 years, 3 months ago

    Man, you are definitely beyond PHP-Ext, because: - PHP-Ext try to be compatible to PHP4, which is a lost o time and features - You use autoload. Really, I can´t understand how people live without it. - You don´t rewrite nothing, and let the user keep updated with exJS by his own - Your code style like: width(300)-> height(150)-> is great! Looks like blocks/closures (wouldn´t be nice php support it?) The only problem is that convertextjs.php is too complex. It could be splited in more files/classes. And the total absence of tests is a shame :( Congratulation and good luck with the project!

    Link / Reply
  • admin 5 years, 3 months ago

    @Lorenzo Could it be that I somehow forgot to wrap json.php in the archive? If so, I deeply apologize and I will make sure to fix this when I return from SXSW @Donald Well, yes I have. This is different than what I expected: they have definitely focused on improving ActiveRecords' semantics. Very interesting. @Nevers and others Thanks for the comments. Actually I have some unit tests on my local disk I just didn't wrap them because they aren't a complete test suite. And yes, I shoved the whole converter in one big file, which makes it a big awkward to read I know :/ Regarding PHP-Ext, I believe that the author is pursuing different goals than I am. He obviously had to rewrite a lot of code due to the limitations of PHP4. I was free to ignore PHP4 and that certainly makes ExtPHP more flexible, at the price of being useless if your web host is still running PHP4 :(

    Link / Reply
  • Donald 5 years, 3 months ago

    @Admin: Thanks for checking out our "un-framework" keep an eye on it in the coming weeks as we have a couple more anouncements/features that we will be anouncing. Since you have taken the time to look at it you can see that this system of doing this take a different approach to a framework but still allows for rapid deployment as well as allows for much easier custom screens/pages than most traditional frameworks out there, as well as taking the validation away from the interface which is not always perfect it put the validation in the database level, this way you can never end up with invalid data. If you continue to use it more, which I suggest you do because you wont realize the full potential until you have been using it for some time, check out our sourceforge site http://www.sourceforge.net/projects/andro as it is very active and if you have any issues/questions/feature requests or suggestions submit them and who know it might even be fixed/add that week depending on our schedules and if its something that intrigues us. But thank you for taking a look at it. You are hoping to star development to allow for supporting other databases first on the list is MySQL.

    Link / Reply
  • ExtJS pour PHP : ExtPHP, ou PHP-Ext? 5 years, 3 months ago

    [...]  ExtPHP (0 visite) [...]

    Link / Reply
  • ExtJS pour PHP : ExtPHP, ou PHP-Ext? 5 years, 3 months ago

    [...]  ExtPHP (0 visite) [...]

    Link / Reply
  • james 5 years, 3 months ago

    Hmm, doesn't work for me. When i run convertextjs.php it gives me load of stuff scrolling and then next thing i know, it didnt generate any files for me. I even chmodded the whole directory to 777 just to make sure but still no go. Any idea why?

    Link / Reply
  • Cole Design Studios 5 years, 3 months ago

    [...] As both the Zend Developer Zone and Ajaxian point out, there’s been two new projects based on the Ext JS user interface widget system adapted for PHP - PHP-Ext and ExtPHP. PHP-Ext is an open source widget library written for PHP 4 and 5 to empower the UI Layer. It is based on Ext JS javascript widgets which provide a standard and powerful API to build Rich Internet Applications. It basically works as a convenient wrapper for the Ext JS Javascript Objects. [...]

    Link / Reply
  • admin 5 years, 3 months ago

    @james & @Lorenzo Guys, I rewrapped the package. If you download it again from SourceForge, you will see that it now contains a proper json.php

    Link / Reply
  • aadsaca 5 years, 3 months ago

    To all, I just want to know on how to integrate Cakephp with EXTJS? pls help me.... Tnx.

    Link / Reply
  • Stephane 5 years, 2 months ago

    A framework you might be interested in is SimplicityPHP which is integrated with Ext.

    Link / Reply
  • Seiti 5 years, 2 months ago

    Hello! Great work! Unfortunately I didn't get it to work. The sample code did not run until I'd made the following changes: function __autoload($class_name) { // CamelCase => camel_case if (0 == strncmp($class_name, 'Ext_', 4)) { $name = str_replace('_Config', '', $class_name); $name = str_replace('_', '.', $name); $exploded = explode('.', $name); if (count($exploded) > 2) { $exploded[1] = strtolower($exploded[1]); $name = implode('.', $exploded); } include_once("libs/extphp/$name.php"); } } Now I'm stuck with a javascript error: Ext is not defined...

    Link / Reply
  • Seiti 5 years, 2 months ago

    Silly me! I forgot to place the ExtJS files in the correct directory. Now it is running fine! Thx!

    Link / Reply
  • admin 5 years, 2 months ago

    Seiti, glad to see that it is working. Let me know if you think that you missed this detail due to poor documentation!

    Link / Reply
  • Seiti 5 years, 2 months ago

    Hello Admin! Besides the autoload() I slightly changed the JSReady class, allowing the developer to use a template engine, like smarty, passing the javascript code around as a variable. main.php: class JsReady { private $script; /** * Constructor. * * @param string $body * @param boolean $print * @return string */ function __construct($body, $print = true) { $prefix = "Ext.onReady(function()\n{\n"; $suffix = "\n});\n"; $this->script = $prefix . $body . $suffix; if ($print) print $this->script; } /** * Returns the script * * @return string */ function getScript() { return $this->script; } } I successfully implemented a grid php class using the wrapper, now I'm struggling to implement insert/update/delete via Ajax callbacks. =)

    Link / Reply
  • Seiti 5 years, 2 months ago

    In time: the docs are great, but what we (or maybe just me) really need are more examples =)

    Link / Reply
  • Seiti 5 years, 2 months ago

    Is it possible to set a callback handler using ExtPHP? I set a Ext_grid_EditorGridPanel_Config and added a 'tbar' attribute: gridpanelconfigobject->tbar(array('->', array('text'=>'Refresh', 'tooltip' => 'Refresh the grid', 'iconCls'=>'refresh', 'handler'=>'updateGrid') ) And the addRecord is rendered as a string. I could use a JsFunction() instead, but I noticed that the Javascript code does not create any variable to assign the instantiated classes. How can I call the reload() method of the datastore object?

    Link / Reply
  • Seiti 5 years, 2 months ago

    Hi! Just in case someone find it useful. That did the trick about the js variables. The $this->datastore['name'] points to a object of the Ext.data.Store class: ---- //creating js variables JsWriter::write('var '. $this->datastore['name'] . ' = '); $this->datastore['object']->jsrender(); JsWriter::write(";"); JsWriter::write('var '. $this->panel['name'] . ' = '); $this->panel['object']->jsrender(); JsWriter::write(";"); //getting the javascript code $js = new JsReady(JsWriter::get(), false); $out = $js->getScript(); ---- Then, to set a callback, I just instantiated a JsFunction(): ---- 'handler' => new JsFunction(null, "{$this->datastore['name']}.reload()" ) ---- Great wrapper!

    Link / Reply
  • Seiti 5 years, 2 months ago

    Me again! Found a bug on Ext.data.Record.php: ---- static function create($o= null) { if(gettype($o)=='array') $o = JsWriter::JSON($o); $o=JsWriter::JSON($o); $out =

    Link / Reply
  • pempem 5 years, 2 months ago

    Great job ! I use it often now and I like it. Just a problem now: The FormPanel doesn't contain the config options of the basicForm class. In ext, formpanel extend panel BUT include the configuration option of the basicForm class (see the bold explaination in Ext formPanel doc). How could I fix that problem (or is there a better solution ?) ?

    Link / Reply
  • admin 5 years, 1 month ago

    Guys, sorry for not replying earlier. A lot of your comments were in the 'Possible spam, must validate manually' basket. Not sure why. @Seiti, I really appreciate your contribution. I wonder why the code you mention in comment #31 was created this way. I'll check. @pempem I believe that I am going to have to start adding some special cases to the converter, to handle these "special places" where Jack used his own magic tricks. In the meantime, your FormPanel configuration class could extend BasicForm's config class but this sounds dirty. I have to check the code... Some of you may be wondering "When are you going to release a more polished version?" and you are right to wonder. I guess I am doing what a lot of other people have been doing lately...waiting to see what happens with ExtJS' license. What do you guys think? Are you using the library professionally? In an open-source project? Do you fear the license changes?

    Link / Reply
  • Accilies 4 years, 11 months ago

    Hi, I have been working on this wrapper and I found that Public Events dont get registered in the wrapper from the documentation. Can you please update if you have worked on that bit !! Also, i would like to know if you have any idea of the document generator used for the EXTJS documentation... is it JSDocs ? Awaiting response! Regards, Accilies

    Link / Reply
  • MusicLover 4 years, 11 months ago

    I think the next thing you need to look at including is Javascript functions passed as part of a specification array, one example being renderer in the column definitions for ExtGrid. when inputting the array using the php 'renderer' => "Ext.util.Format.dateRenderer('d.m.y')" this comes out Json-ed as "renderer":"Ext.util.Format.dateRenderer('d.m.y')" so obviously the Ext ignores this renderer adn just uses the default one the easiest hack for this is to do a str_replace on the json array string however I'm not sure on how accurate that would end-up Still, rather good project though, although I'd point out in the example with the new ExtJS documentation I had to add: $name = str_replace('.Data.', '.data.', $name); I started work on one specifically for grid before I though surely someone must have written one of these before, but your code seems to be having the same problem as mine does.

    Link / Reply
  • Jefferson Giro 4 years, 10 months ago

    [...] Vocé é um desenvolvedor PHP pensando em utilizar a ExtJS mas não está afim de escrever toneladas de javascript? Dê uma olhada no PHP-Ext, ele é um wrapper que permite que você codifique seus widgets com PHP mesmo. Pra quem utiliza o Zend Framework ele se torna bem interessante frente à alternativas como a ExtPHP pois já segue a nomenclatura de classes utilizada no ZF. Em breve pretendo postar um tutorial sobre PHP-Ext + Zend Framework, aguardem e confiem ;^D. [...]

    Link / Reply
  • gevik 3 years ago

    Ext4Yii is another alternative to ExtPHP. Take a look at www.ext4yii.com

    Link / Reply
  • chiprodoy 1 year, 7 months ago

    hi admin, I am very interested and grateful for your program, but I want to ask how to add plugins extjs? thanks for your answer.. sorry for my bad english

    Link / Reply
  • Comment awaiting approval 5 months, 4 weeks ago

New Comment

required
required (not published)
optional

Recent Tweets

Categories

Feeds

RSS / Atom