Wednesday, May 21st, 2008

Dojo and Zend Framework Integration Released

Category: Dojo, PHP

<p>The Zend Framework aims to be a top notch framework for building next generation Web applications in PHP. Dojo has similar aims on the front-end side, so they decided to join forces to provide an integration layer. If you like the combination you will have a better, tighter, way to build your applications.

What we see in the initial release is:

  • JSON-RPC Server: We are re-working the Zend_Json_Server that has
    been in our incubator since, oh, what? 0.2.0? and never released to
    actually follow a specification:
    JSON-RPC. This
    will allow it to work seamlessly with Dojo, as well as other toolkits
    that have JSON-RPC client implementations. I have actually completed
    work on this, though the proposal is waiting to be approved; if you want
    to check it out, you can find it in the
    ZF svn.

    The original Zend_Json_Server implementation will be abandoned. It was
    never fully tested nor fully documented, which has prevented its
    release. Additionally, since it implemented its own ad-hoc standard, it
    did not provide the type of interoperability that a true JSON-RPC server
    implementation will provide. I am excited that we will finally be able
    to provide a standards-compliant solution for general availability.

    One final note: there are currently two different JSON-RPC
    specifications, 1.0 and 2.0. My goal is to support each, though for the
    time being, only version 1.0 will be supported, as that is the version
    Dojo currently targets.

  • dojo() View Helper: Enabling Dojo for a page is not typically as
    trivial as just loading the dojo.js script — you have a
    choice of loading it from the AOL CDN or a local path, and also may want
    or need to load additional dojo, dijit, or dojox modules, specify custom
    modules and paths, specify code to run at onLoad(), and
    specify stylesheets for decorating dijits. On top of this, this
    information may change from page to page, and may only be needed for
    a subset of pages. The dojo() view helper will act as a
    placeholder
    implementation, and facilitate all of the above tasks, as well as take
    care of rendering the necessary style and
    script elements in your page.
  • Form Element implementations: One area that developers really
    leverage javascript and ajax toolkits is forms. In particular, many
    types of form input can benefit from advanced and rich user interfaces
    that only javascript can provide: calendar choosers, time selectors,
    etc. Additionally, many like to use client-side validation in order to
    provide instantaneous validation feedback to users (instead of requiring
    a round-trip to the server). We will be identifying a small group of
    form elements that we feel solve the most relevant use cases, and write
    Dojo-specific versions that can be utilized with Zend_Form.
    (One thing to note: Zend_Form‘s design already works very
    well with Dojo, allowing many widgets and client-side validations to be
    created by simply setting the appropriate element attributes.)
  • dojo.data Compatibility: dojo.data defines a
    standard storage interface; services providing data in this format can
    then be consumed by a variety of Dojo facilities to provide highly
    flexible and dynamic content for your user interfaces. We will be
    building a component that will create dojo.data compatible payloads with
    which to respond to XmlHttpRequests; you will simply need to pass in the
    data, and provide metadata regarding it.

Of course, you can continue to any Ajax library in conjunction with the Zend Framework, and ditto for Dojo…. but why did this match happen?

There are many synergies and similarities between the two projects and their communities, including:

  • Licensing and IP: Both projects are very business friendly.
  • Design affinity: Similar philosophies, including a strong emphasis on use-at-will architecture.
  • JSON format used strongly in both
  • Comprehensive Ajax Solution: Dojo has it all
  • Standards: “Dojo not only implements published standards, but also drives them”
  • Communities and support: Strong communities, with support offerings behind them

And, here is some code from a JSON-RPC demo:

  1. <h2>Dojo JSON-RPC Demo</h2>
  2. <input name="foo" type="button" value="Demo" onClick="demoRpc()"/>
  3. < ?
  4. $this->dojo()->setLocalPath('/js/dojo/dojo.js')
  5.              ->addStyleSheetModule('dijit.themes.tundra')
  6.              ->requireModule('dojo.rpc.JsonService');
  7. $this->headScript()->captureStart(); ?>
  8. function demoRpc()
  9. {
  10.     var myObject = new dojo.rpc.JsonService('/json-rpc.php');
  11.     console.log(myObject.bar());
  12. }
  13. < ? $this->headScript()->captureEnd() ?>

Posted by Dion Almaer at 10:01 am
5 Comments

+++--
3.8 rating from 83 votes

5 Comments »

Comments feed TrackBack URI

It was predictable, and I as a php developer am so happy about it,
but Zend_Framework really needs more widgets like grid.
Great work guys, congratulation.

Comment by csjs — May 21, 2008

Caveat: I’m software architect for Zend Framework, and I authored most of the above announcement. ;-)

Now that we have partnered with Dojo, widgets like grids become incredibly simple to produce. Why? Because we will have a dojo.data compatible container we can return results in, which allows us to leverage Dojo’s own grid capabilities. This means we don’t have to worry about the UI, just having endpoints on the server to handle the various calls.

I’m very excited about the possibilities the partnership provides, and look forward to delivering new integration points for developers to utilize.

Comment by weierophinney — May 21, 2008

I hoped to see this news with s/Dojo/jQuery/…

how easy would be to swap in one for the other?

Comment by giallu — May 22, 2008

@giallu: Much of this integration is based on JSON-RPC and dojo.data, so I’m not sure how easy/difficult that would be to implement with jQuery. You might also find http://dojocampus.org/content/2008/03/13/creating-your-own/ to be interesting…

Comment by Dylan Schiemann — May 22, 2008

Good Details about the zend technologies.
http://www.confirmlinks.com/

Comment by custumsoftware — May 24, 2008

Leave a comment

You must be logged in to post a comment.