Your SlideShare is downloading. ×
PHP Server-side Breakout
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

PHP Server-side Breakout

3,655
views

Published on

Understand the approaches and best practices for integrating client side applications - both desktop and mobile - with various server-side technologies. …

Understand the approaches and best practices for integrating client side applications - both desktop and mobile - with various server-side technologies.

Grgur Grisogono, Modus Create, is a JavaScript lover focused on Ext JS and Sencha Touch. Exploiting the passion as a Sr JavaScript developer at Modus Create. Grgur has architected and developed market leading national, regional, and local development web apps used by 6 governments, 600+ municipalities, and government departments in several European countries. This year, he has organized Sourc{, a hugely successful developer oriented mobile and desktop web app conference, sponsored by Sencha.

Published in: Technology

1 Comment
1 Like
Statistics
Notes
  • it is very helpful slide...my many problems solved...
    now I know what directory structure to use for scalable apps, and some other things.
    Thanks
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
3,655
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
36
Comments
1
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. SERVER SIDE BREAKOUT phpWednesday, November 2, 11
  • 2. 5 YEARS AGO (2006) PHP version 5.2.0 native JSON supportWednesday, November 2, 11
  • 3. MODERN USAGE 77% of all websitesWednesday, November 2, 11
  • 4. MODERN USAGE MiddlewareWednesday, November 2, 11
  • 5. INTERFACES REST Ext.DirectWednesday, November 2, 11
  • 6. REST Great for APIs Cross-domain Status code messages One setup for all purposes echo $jsonWednesday, November 2, 11
  • 7. REST proxy: { type: rest, url: api/users }Wednesday, November 2, 11
  • 8. REST Extra server setup may be needed Difficult concurrency (buffering) Requires access to php://inputWednesday, November 2, 11
  • 9. EXT.DIRECT OOB buffering Effortless setup API integration (RPC) Easier RPC role-based method distribution return $arrayWednesday, November 2, 11
  • 10. EXT.DIRECT Ext.ns("Ext.app"); Ext.app.REMOTING_API = { "url":"php/router.php", "type":"remoting", "actions":{ "TestAction":[ {"name":"doEcho","len":1} ] } };Wednesday, November 2, 11
  • 11. EXT.DIRECT proxy: { type: direct, directFn: doEcho }Wednesday, November 2, 11
  • 12. EXT.DIRECT proxy: { type: direct, api: { create : Rpc.users.Add, read : Rpc.users.List, update : Rpc.users.Update, delete : Rpc.users.Delete }Wednesday, November 2, 11
  • 13. EXT.DIRECT Not cross-domain friendly Needs a router (s-s stack) No file uploading Exception stops executionWednesday, November 2, 11
  • 14. SAMPLE USAGE RESTFUL INTERFACEWednesday, November 2, 11
  • 15. EXT.DIRECTWednesday, November 2, 11
  • 16. JSON VS. JSONP { Ext.util.JSONP.callback1({ ‘name’ : ‘John’, ‘name’ : ‘John’, ‘email’ : ‘john@smith.com, ‘email’ : ‘john@smith.com, ‘dob‘ : 19781213, ‘dob‘ : 19781213, ‘kids‘ : [‘Sarah’, ‘Norah’] ‘kids‘ : [‘Sarah’, ‘Norah’] } })Wednesday, November 2, 11
  • 17. JSON VS. JSONP $callback = $_REQUEST[“callback”]; $select = $db->select()->from(products); $stmt = $select->query(); $result = $stmt->fetchAll(); $output = json_encode($result); if ($callback) { header(Content-Type: text/javascript); echo $callback . ( . $output . );; } else { header(Content-Type: application/x-json); echo $output; }Wednesday, November 2, 11
  • 18. BIG APPS Big appsWednesday, November 2, 11
  • 19. BIG APPS MVC Fat model - thin controllerWednesday, November 2, 11
  • 20. BIG APPS AbstractingWednesday, November 2, 11
  • 21. LOADING APP COMPONENTS Ext.Loader Sencha command / jsbuilder on the flyWednesday, November 2, 11
  • 22. ENVIRONMENT ApacheWednesday, November 2, 11
  • 23. ENVIRONMENT Apache + Nginx reverse proxyWednesday, November 2, 11
  • 24. ENVIRONMENT SetEnv APP_ENV "development" $_SERVER[APP_ENV])Wednesday, November 2, 11
  • 25. ENVIRONMENT MIME handling JSONP : application/javascript JSON : application/json appcache : text/cache-manifestWednesday, November 2, 11
  • 26. ENVIRONMENT File structureWednesday, November 2, 11
  • 27. Wednesday, November 2, 11
  • 28. ENVIRONMENT DB layoutWednesday, November 2, 11
  • 29. TRADITIONAL RELATIONAL MODELWednesday, November 2, 11
  • 30. CENTRALIZED RELATIONAL MODELWednesday, November 2, 11
  • 31. Wednesday, November 2, 11
  • 32. FIREPHP $logger = new Zend_Log(); $writer = new Zend_Log_Writer_Firebug(); $logger->addWriter($writer); Zend_Registry::set(logger,$logger);Wednesday, November 2, 11
  • 33. FIREPHP $select = $ssoDb->select() ->from(products); $logger->log($select->__toString(), Zend_Log::INFO); $logger->log($data, Zend_Log::INFO);Wednesday, November 2, 11
  • 34. BAD IDEAS Enclose entire class in a single try/catch block Use sleep to wait for another task/thread to finish Setting global vars to return multiple values Altering framework files Performing DB aggregate operations in PHP Keeping connections openWednesday, November 2, 11
  • 35. BAD IDEAS Using self-made cyphers for encryption Clear text passwords, CC info, personal details (inc names) Not checking for user credentials on every request Trusting client-side input validation Constructing sql queries by using concatenation Not using DB transactions on multiple changes Direct access to files for downloadWednesday, November 2, 11
  • 36. Grgur Grisogono @ggrgurWednesday, November 2, 11