building desktop rias with javascript and php - zendcon09
DESCRIPTION
Web runtimes like Adobe AIR, Titanium and webOS open up interesting possibilities for web developers, allowing them to leverage their existing skills to develop desktop applications. Aimed at current PHP developers, this talk will focus on common web application technologies - PHP, HTML, Javascript - and explore how to utilize them to create desktop "Rich Internet Applications."TRANSCRIPT
![Page 1: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/1.jpg)
Building Desktop RIAs with PHP and JavaScriptEd Finkler • funkatron.com • @funkatronZendCon 09 • #thistalksucks
![Page 2: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/2.jpg)
What to expect
This is mainly a JavaScript talk
jQuery framework for JS examples
But we talk about PHP on the server and the desktop, too
This is mainly a desktop app dev talk
Diffs between server app dev and desktop app dev
Examples of desktop app <-> server app interaction
![Page 3: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/3.jpg)
Web runtimes
A browser engine environment used for building "local" apps
![Page 4: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/4.jpg)
Current web runtimesAIR (adobe.com/go/air)
Desktop
Titanium (appcelerator.com)
Desktop
Mobile
Palm webOS (developer.palm.com)
Mobile
![Page 5: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/5.jpg)
We'll use AIR & Titanium
But others bear examination
![Page 6: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/6.jpg)
JavaScript on the Desktop
Can use (almost) any available JS libs/frameworks
No cross-domain restrictions
security restrictions in app sandbox (AIR only)
![Page 7: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/7.jpg)
Desktop vs Server-side
PHP stack is built up/torn down every time
mem leaks not much of an issue
exec time < a few seconds max
almost always synchronous calls
Desktop apps are persistent
exec time can be hours or days
mem leaks a HUGE issue
lots of asynchronous calls
![Page 8: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/8.jpg)
JavaScript frameworks
Some stuff in JS SUCKS without a framework
Lots of choices
![Page 9: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/9.jpg)
jQuery pwnz yoo
jQuery is teh awesome (for some stuff)
but you can use anything
![Page 10: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/10.jpg)
PHPtubby jedi master
JavaScripthyper frontman
PHP is your server-side buddy
Use 5.2 at least (you are, right?)
adds native JSON encoding/decoding
![Page 11: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/11.jpg)
PHP talking to JS Desktop
Serve data structures instead of HTML
Use JSON
Use JSON
USE JSONdo not use XML (if you can avoid it)
set the correct mime type (application/json)
![Page 12: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/12.jpg)
Example 1:PHP duz yer math
Async calls using jQuery AJAX methods
Communicate via JSON
Zee Cloudweb server
Webkit
Flash
![Page 13: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/13.jpg)
Example 2:PHP 'shops yer pics
Uploading via Flash APIs
JSON based communication
Zee Cloudweb server
Webkit
Flash
![Page 14: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/14.jpg)
Only works in Titanium Desktop (0.7 or higher)
Also doable with Ruby and Python
PHP support in Titanium is still a work in progress
PHP & jQuery:THE UNHOLY UNION
![Page 15: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/15.jpg)
Additional resourcesAdobe AIR for JavaScript Developers Pocketguidehttp://www.tostring.org/
Developing Adobe® AIR™ Applications with HTML and Ajaxhttp://short.ie/ggd9tc
Titaniumhttp://appcelerator.comhttp://codestrong.com
Titanium Forumshttp://short.ie/d4ponk
Searchatron Sourcehttp://short.ie/g9z6qt
![Page 16: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/16.jpg)
Additional resourcesDearZend.com sourcehttp://github.com/funkatron/dearzend-serverhttp://github.com/funkatron/dearzend-client
Spaz Desktop Sourcehttp://code.google.com/p/spaz/
Spaz webOS Sourcehttp://github.com/funkatron/spaz-webos/
SpazCorehttp://github.com/funkatron/spazcore
![Page 17: Building Desktop RIAs with JavaScript and PHP - ZendCon09](https://reader034.vdocuments.site/reader034/viewer/2022052410/55535574b4c9059e688b53c1/html5/thumbnails/17.jpg)
Questions?@funkatron • funkatron.com • joind.in/922