SlideShare a Scribd company logo
1 of 111
http://www.egeniq.com
                                            info@egeniq.com
                                                    @egeniq




Mobile for PHP Developers
               a 3 hour primer



                        Ivo Jansch
               php|tek, May 2011
About Me




@ijansch
Developer
Author
Entreprenerd
PHP



               2
About Egeniq




Startup
Mobile
Tech
Knowledge
Geeks
Development


               3
Contents



ā€£ Part 1: Putting mobile in perspective
ā€£ Part 2: Browser based mobile applications
ā€£ Part 3: A few words on frontend design
ā€£ Part 4: Cool stuff with PHP and native apps
ā€£ Part 5: APIs for native apps
ā€£ Part 6: Web vs Native: best of both worlds
ā€£ Part 7: Random bits if time permits
                                                4
Part 1
Letā€™s think about mobile for a few minutes



                                             5
The Web
Is increasingly portable




                           6
Itā€™s revolutionary



               Much like when
               the phone lost
               its wall socket



                                 7
The Internet Of Things
ivo-imac:~ ivo$ ping fridge
PING fridge (192.168.1.138): 56 data bytes
                                             8
The Web versus The Internet




                              9
Usage Characteristics



ā€£ On the go
ā€£ Short attention span
ā€£ Avoid typing
ā€£ To the point / ad hoc
ā€£ Omnipresent
ā€£ Context Awareness

                          10
ā€˜Pocket Essentialsā€™




                      11
Usage - ā€˜Couch Computingā€™




ā€£ Relaxed
ā€£ Freedom
ā€£ Consumption
ā€£ Convergence
ā€£ Companion

                            12
Mobile Technologies




ā€£ Objective-C (iPhone, iPad, iPod Touch, Apple
  TV)
ā€£ Java (Android, Blackberry, Symbian)
ā€£ HTML5 / Javascript (Any)
ā€£ PHP (Any)

                                                 13
The App vs. The Browser




                          14
Browser based applications




ā€£ Write once, run anywhere
ā€£ Online
ā€£ Requires browser
ā€£ Page based
ā€£ ā€˜Statelessā€™

                             15
Native Apps


ā€£ On- and offline
ā€£ Event based
ā€£ Native device experience
ā€£ Convenient access to device features
ā€£ Stateful
ā€£ Monetization through App Stores


                                         16
Some statistics




ā€£ Android Market: 100.000 apps
ā€£ Apple App Store: 300.000 apps
ā€£ Web: 3.000.000 websites optimized for
     mobile
Sources:

ā€£    http://www.bizreport.com/2010/10/dotmobi-2000-growth-in-number-of-mobile-ready-websites.html#

ā€£    http://twitter.com/AndroidDev/status/28701488389

ā€£    http://www.silobreaker.com/apples-app-store-crosses-300000-apps-5_2263799272514256896



                                                                                                     17
Predictions




              18
Part 2
Browser Based Mobile Apps



                            19
10 years ago




Source: freewebmasterhelp.com
                                20
A little over 4 years ago




Source: Mobiforge.com
                            21
4 years ago




              22
Dealing with a smaller screen




2 ways to render a regular website:
ā€£ Keyhole
ā€£ Scaled


                                      23
Keyhole




          24
Scaled




         25
A pixel is not a pixel

                         640
             1020




                               26
A pixel is not a pixel




Viewports:




ā€£ Invented by Apple
ā€£ Adopted by others
ā€£ Unofficial standard, registered at whatwg.org
                                                  27
A pixel is not a pixel

             320                 640




480                      960




           iPhone 3            iPhone 4
                                          28
A pixel is not a pixel




CSS 2.1 Specification:
ā€œIf the pixel density of the output device is very different from that of a typical computer display,
the user agent should rescale pixel values. It is recommended that the pixel unit refer to the
whole number of device pixels that best approximates the reference pixel. It is recommended
that the reference pixel be the visual angle of one pixel on a device with a pixel density of
96dpi and a distance from the reader of an armā€™s length.ā€




                                                                                                   29
Standardization Horror


ā€£ <meta name=ā€viewportā€ content=ā€width=device-widthā€ />
 ā€¢ iPhone and most others
ā€£ <meta name=ā€HandheldFriendlyā€ content=ā€trueā€ />
 ā€¢ Many feature phones (originally Palm)
ā€£ <meta name=ā€MobileOptimizedā€ content=ā€320ā€ />
 ā€¢ Windows Mobile
ā€£ <meta name=ā€viewportā€
        content=ā€target-densitydpi=device-dpiā€ />
 ā€¢ Android

                                                          30
A pixel is not a pixel




Recommended reading:
http://www.quirksmode.org/blog/ by Peter Paul Koch




                                                     31
Device Detection




Itā€™s all in the User Agent

 ā€¢ Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X;
   en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version /
   4.0.5 Mobile/8B117 Safari/6531.22.7
 ā€¢ Mozilla/5.0 (Linux; U; Android 2.1-update1; nl-nl; HTC Hero
   Build/ERE27) AppleWebKit/ 530.17 (KHTML, like Gecko)
   Version/4.0 Mobile Safari/ 530.17


                                                            32
Device Detection




                   33
Donā€™t Reinvent The Wheel


http://detectmobilebrowsers.mobi/

 ā€¢ Downloadable PHP library
   for device detection
 ā€¢ Online code generator
 ā€¢ Donationware
 ā€¢ Ugly code, well documented




                                    34
On to a more advanced mechanism


ā€£ General tip:
 ā€¢ donā€™t rely on device
 ā€¢ rely on capabilities


ā€£ WURFL
 ā€¢ Wireless Universal Resource FiLe
 ā€¢ Contains info on 500+ capabilities of 14.000+ devices
 ā€¢ http://wurfl.sourceforge.net/
 ā€¢ Clients available for many languages
                                                           35
WURFL in PHP: Tera-Wurfl


ā€£ Download Tera-Wurfl
 ā€¢ http://www.tera-wurfl.com


ā€£ Install in document root
 ā€¢ e.g. in /var/www/yoursite/Tera-WURFL
 ā€¢ Make sure data/ dir is apache read+writable


ā€£ Create empty database
                                                 36
Tera-WURFL Setup

ā€£ Copy TeraWurflConfig.php.example
 ā€¢ Edit database settings




ā€£ Browse to:
 ā€¢ http://yoursite/Tera-Wurfl/admin/install.php
                                                  37
Tera-WURFL Setup




                   38
Tera-WURFL Setup




                   39
Tera-WURFL Administration




                            40
Tera-WURFL code samples




                          41
Tera-WURFL code samples




                          42
Tera-WURFL code samples




                          43
Tera-WURFL code samples




                          44
Tera-WURFL output




                    45
Alternatives

ā€£ http://www.deviceatlas.com
 ā€¢ Commercial database of device properties
 ā€¢ Available online, as API and downloadable
   json file
 ā€¢ Free for development
 ā€¢ ~99$/year for production




                                               46
Browser Detection In Practice



ā€£ Letā€™s optimize a site with what weā€™ve learned
  so far.


ā€£ Letā€™s take advantage of ZFā€™s powerful MVC
  set up
 ā€¢ View scripts determine layout of actions
 ā€¢ Layout script wraps everything into main layout
 ā€¢ Use Bootstrapper to detect device and setup MVC

                                                     47
Zend Framework mobile site




                         2 ways for mobile layout:
                         ā€£ Separate files
                         ā€£ Separate folders
                         Detection in bootstrap


                                                  48
layouts/scripts/layout_mobile.phtml




                                      49
views_mobile/scripts/index/index.phtml




                                         50
Bootstrap.php




                51
Result




Try it at http://egeniq.com/demo/zf/public
                                             52
Zend_Http_UserAgent




ā€£ New in Zend Framework 1.11
ā€£ Can work with WURFL or Device Atlas




                                        53
Dealing With Mobile Browsers




ā€£ Considerations:
 ā€¢ Donā€™t redirect to homepage
 ā€¢ Offer ā€˜classicā€™ option
 ā€¢ Donā€™t make assumptions on physical screen size




                                                    54
Part 3
A few words on front end design



                                  55
UI Design



ā€£ Hover = evil
ā€£ ā€˜Finger Friendly Designā€™
ā€£ ā€˜Touch Driven Developmentā€™
ā€£ Screens are getting bigger and (!) smaller



                                               56
Scalable websites




http://www.niemanlab.org/2010/09/nyts-opinion-pages-continue-the-march-toward-app-
inspired-design/

                                                                                     57
HTML5 is easy




ā€£ <!doctype html> - period.
ā€£ <script> or <style> - period.
ā€£ Semantics: header, footer, section, article
  tags



                                                58
HTML5 is powerful



ā€£ localStorage
ā€£ <video>
ā€£ <canvas>
ā€£ <svg>
ā€£ <input type=ā€numberā€> and many other form
 fields
ā€£ navigator.geolocation.getCurrentPosition();
                                                59
Browsers love HTML5



Browsers supporting HTML5:
ā€£ Firefox
ā€£ Safari
ā€£ Opera
ā€£ All the mobile browsers
ā€£ IE (sort of, no support for <article> until IE9)

                                                     60
Things to consider




ā€£ Donā€™t just scale the layout, scale content too
ā€£ Consider ā€˜scenario based content
  managementā€™




                                                   61
jQTouch




          62
jQTouch




ā€£ iPhone experience in HTML5
ā€£ http://jqtouch.com/ (beta 3)
ā€£ jQuery based
ā€£ MIT License
ā€£ Give it a try: http://jqtouch.com/preview/
  demos/main

                                               63
Alternatives




ā€£ jQuery Mobile
 ā€¢ 1.0 alpha was released at October 16, 2010
 ā€¢ http://jquerymobile.com/
ā€£ Sencha Touch
 ā€¢ From the makers of jqTouch
 ā€¢ Tablet support
 ā€¢ http://www.sencha.com/products/touch/

                                                64
Simple tricks




Making phone calls from a web page:




                                      65
Simple tricks




Open Maps application:




                         66
You already know PHP




Your PHP skills + HTML5 = easy mobile
websites




                                        67
Part 4
Doing Cool Stuff With PHP And Native Apps



                                            68
QR Codes




ā€£ http://phpqrcode.sourceforge.net



                                     69
QR Codes: URLs




                 70
QR Codes: MECARDs




                    71
QR Codes: MECARDs




                    72
Tiqr demo


ā€£ Authentication with a smart phone

ā€£ Components
 ā€¢ Client: iPhone, Android
 ā€¢ Server: Zend Framework, simpleSAMLphp or plain PHP
 ā€¢ Standards: OATH OCRA, SHA-x, HOTP, SAML
 ā€¢ License: BSD


ā€£ http://www.tiqr.org
                                                        73
Tiqr Diagram




               74
Tiqr Integration




                   75
Device Notifications




ā€£ A way to get attention
ā€£ Use with caution



                           76
Notifications

ā€£ Apple
  ā€¢ Push Notifications
  ā€¢ http://code.google.com/p/apns-php/
ā€£ Android
  ā€¢ Cloud To Device Messaging (c2dm)
  ā€¢ https://github.com/mwillbanks/
    Zend_Service_Google_C2dm/

ā€£ BlackBerry
  ā€¢ BlackBerry Push Service
  ā€¢ CURL
                                         77
Notifications




                              Apple Push
Your Server                   Notiļ¬cation
                deviceToken                 message
                  message
                               Services     payload
                  payload
                 signature                            Your
                                                      App




                                                        78
Notifications




                79
Notifications - Android




                          80
Notifications - Android




                          81
Notifications - Notes




ā€£ For Apple:
  ā€¢ Get certificates from the developer portal
ā€£ For Android
  ā€¢ Need to register an account and request a quota


ā€£ Note: deviceTokens can change!

                                                      82
Token Exchange
                                  notiļ¬cationToken




                                   Apple Push
Your Server                        Notiļ¬cation
                    deviceToken                             message
                      message
                                    Services                payload
                      payload
                     signature                                            Your
                                                                          App
                     notiļ¬cationToken
                                                     deviceToken

      deviceToken
                                    Token                   notiļ¬cationToken

                                   Exchange

            http://tokenexchange.googlecode.com
                                                                               83
Part 5
APIs for Native Apps



                       84
PHPā€™s role in native apps




                        Android   Blackberry
        iPhone App
                         App         App




                            API



                                               85
Optimize APIs for mobile




ā€£ Content optimization
ā€£ Scalability
ā€£ Longevity
ā€£ Security
ā€£ Client/Server
  considerations

                           86
Content Optimization




ā€£ Consider CPU and memory constraints
 ā€¢ Prefer JSON over XML
 ā€¢ Compress data
 ā€¢ Keep responses small
 ā€¢ But not too small (connection / routing overhead)




                                                       87
Scalability




ā€£ AppStore featured/top listings Slashdot
  effect
ā€£ Consider the 80/20 rule of app popularity
  though



                                              88
Longevity




ā€£ Apps have different deployment patterns
 ā€¢ No ā€˜quick fixā€™ in the application as in web apps
ā€£ Client/Server asynchronous updates
 ā€¢ Backwards compatibility
   ā€£ Versioned API URLs:
    -   http://iportfolio.api.egeniq.com/portfolios/1.0/mvb/collections.json




                                                                               89
Longevity




ā€£ How long do you support your APIs?
 ā€¢ Canā€™t force people to delete their Apps
 ā€¢ Provide clean fallback
 ā€¢ Synchronized instead of real-time data
ā€£ Implement status check API calls
ā€£ API ownership

                                             90
Longevity - API Ownership




ā€£ Own DNS records
ā€£ Own the initial entry point of the app
ā€£ Donā€™t hardcode URLs

ā€£ By the way: also own the developer account

                                               91
API Security




ā€£ TLS/SSL
ā€£ Basic Auth
ā€£ OAuth? XAuth!
ā€£ PKI / TLSAuth
ā€£ Signed URLs


                  92
Signed URLs




ā€£ Prevent parameter tampering
ā€£ Allow API use by specific client only
ā€£ Simple but effective way to protect API


                                            93
Signed URLs




                   Params +
                   Signature
      Client                     API

   Sign Params                   Verify
  With Signature               Signature        W



                                           94
Signed URLs




                   W



              95
Signed URLs




                   W



              96
Signed URLs




                   W



              97
Client/Server considerations




ā€£ Image Processing in the API, instead of App
 ā€¢ Use Imagick / GD etc.
 ā€¢ Trade-off between bandwidth and processing power
ā€£ Apps support threading / asynchronisity
 ā€¢ Fire-and-forget API design
 ā€¢ Prepare/getResult call duos
ā€£ Push features into PHP APIs for reuse
                                                      98
PHPā€™s role in native apps




ā€£ PHP has native support for:
 ā€¢ Web services
 ā€¢ JSON
 ā€¢ Compression
 ā€¢ Image manipulation
ā€£ Egeniqā€™s number 1 choice for App APIs
ā€£ 25-30% of App development time = API
                                          99
Part 6
Web vs Native: Best of Both Worlds



                                     100
HTML5 in the App Store




ā€£ HTML5 on the server, supports PHP:
 ā€¢ IPFaces - http://www.ipfaces.org/
ā€£ HTML5 on the device, no (or limited) support
  for PHP:
 ā€¢ AppCelerator - http://appcelerator.com/
 ā€¢ Phonegap - http://phonegap.com



                                             101
Cross Compilers = Instant Coffee
                                   102
Part 7
Random bits if time permits



                              103
Testing




ā€£ Various options for testing:
 ā€¢ Get your boss to buy you devices
 ā€¢ Firefox with user agent plugin
 ā€¢ Use Simulators/Emulators
 ā€¢ Use a service such as DeviceAnywhere




                                          104
Running PHP on the device




First: Why??!
ā€£ PHP For Android (PFA)
 ā€¢ http://phpforandroid.net/
ā€£ PAMP for Symbian
 ā€¢ http://wiki.opensource.nokia.com/projects/PAMP



                                                    105
Symfony Mobile


ā€¢ Mime-type based optimisation
ā€¢ http://www.symfony-project.org/blog/2008/06/09/how-
  to-create-an-optimized-version-of-your-website-for-the-
  iphone-in-symfony-1-1




                                                            106
ā€˜Lemon ADEā€™ AST editor




                         107
Resources for PHP/Mobile




ā€¢ http://www.egeniq.com/blog
ā€¢ http://mobile.phpmagazine.net/
ā€¢ http://thoomtech.com/iphone/
  objc-for-php-developers-part-1/




                                    108
http://www.egeniq.com
                                     info@egeniq.com
                                             @egeniq




Thank you! Questions?
       http://joind.in/3412
    http://www.egeniq.com
            ivo@egeniq.com
                   @ijansch
Credits
Pictures used in this presentation are creative commons attribution licensed pictures. Here
are the owners and the URLS where the originals can be found:
ā€˜Dow says POOā€™ by Stepleton - http://www.flickr.com/photos/29407923@N03/2899705638/
ā€˜The telephoneā€™ by Tylerdurden - http://www.flickr.com/photos/tylerdurden/529028040/
ā€˜Webā€™ by Kurtxio - http://www.flickr.com/photos/kurtxio/2182760200/
ā€˜Heavy cloud, no rainā€™ by Robynsnest - http://www.flickr.com/photos/robynsnest/12405841/
ā€˜Wireless fridgeā€™ from http://www.wirelessgoodness.com/tag/srt746awtn/
ā€˜Army iphone appā€™ by Soldiersmediacenter - http://www.flickr.com/photos/soldiersmediacenter/4271795260/
ā€˜Carbon Fibre Walletā€™ by Ryan Loos - http://www.flickr.com/photos/rh1n0/4157547404/
ā€˜Keysā€™ by Jamison Judd - http://www.flickr.com/photos/jamisonjudd/2419601050/
ā€˜Phone Girlā€™ by Steffen - http://www.flickr.com/photos/re-ality/460465894/
ā€˜Icon_safari_hiresā€™ by Hans Dorsch - http://www.flickr.com/photos/hansdorsch/2861804087/
ā€˜Thinkingā€™ by Karola - http://www.flickr.com/photos/karola/3623768629/
ā€˜Jus'a webā€™ by Jusfi - http://www.flickr.com/photos/jusfi/2921202536/
ā€˜iPad :)ā€™ by Korosirego - http://www.flickr.com/photos/korosirego/4334862666/
ā€˜I've got a monkey on my backā€™ by Keven Law - http://www.flickr.com/photos/kevenlaw/2698946160/
ā€˜Add a spoonful of coffeeā€™ by Martyn Wright - http://www.flickr.com/photos/35521221@N05/5181647830/
ā€˜Locked steelā€™ by Darwinbell - http://www.flickr.com/photos/darwinbell/321434733/
ā€˜4 Biscuitsā€™ by Barnoid - http://www.flickr.com/photos/barnoid/2025811494/
ā€˜pining for mauiā€™ by Dā€™Arcy Norman - http://www.flickr.com/photos/dnorman/2223663304/
Credits
Pictures used in this presentation are creative commons attribution licensed pictures. Here
are the owners and the URLS where the originals can be found:
ā€˜Seeing my world through a keyholeā€™ by Kate Ter Haar - http://www.flickr.com/photos/katerha/4592429363/
ā€˜Dear CNN, please send me push notifi...ā€™ by Alex Valentine - http://www.flickr.com/photos/alexvalentine/5644423659/
Ivoā€™s portrait in intro, photo by Jelmer de Haas - http://www.jelmerdehaas.com

More Related Content

What's hot

2011 code camp
2011 code camp2011 code camp
2011 code camp
imranq2
Ā 

What's hot (20)

Native Android Development with Spring
Native Android Development with SpringNative Android Development with Spring
Native Android Development with Spring
Ā 
Making the Mobile Web Native with PhoneGap
Making the Mobile Web Native with PhoneGapMaking the Mobile Web Native with PhoneGap
Making the Mobile Web Native with PhoneGap
Ā 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5
Ā 
ē§»åŠØē«ÆWeb app开发
ē§»åŠØē«ÆWeb app开发ē§»åŠØē«ÆWeb app开发
ē§»åŠØē«ÆWeb app开发
Ā 
2011 code camp
2011 code camp2011 code camp
2011 code camp
Ā 
SOCCNX 2015 - Application Integration Blast
SOCCNX 2015 - Application Integration BlastSOCCNX 2015 - Application Integration Blast
SOCCNX 2015 - Application Integration Blast
Ā 
Mobile Web High Performance
Mobile Web High PerformanceMobile Web High Performance
Mobile Web High Performance
Ā 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
Ā 
Industrialise PHP ~ ZendCon Europe 2013
Industrialise PHP ~ ZendCon Europe 2013Industrialise PHP ~ ZendCon Europe 2013
Industrialise PHP ~ ZendCon Europe 2013
Ā 
Mobile Development: HTML5 Vs. Native
Mobile Development: HTML5 Vs. NativeMobile Development: HTML5 Vs. Native
Mobile Development: HTML5 Vs. Native
Ā 
Mobile applications for SharePoint using HTML5
Mobile applications for SharePoint using HTML5Mobile applications for SharePoint using HTML5
Mobile applications for SharePoint using HTML5
Ā 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Ā 
Seattle bestpractices2010
Seattle bestpractices2010Seattle bestpractices2010
Seattle bestpractices2010
Ā 
Instant app Intro
Instant app IntroInstant app Intro
Instant app Intro
Ā 
Spring Projects Infrastructure
Spring Projects InfrastructureSpring Projects Infrastructure
Spring Projects Infrastructure
Ā 
How to keep calm and ship it (Juozas Kaziukėnas)
How to keep calm and ship it (Juozas Kaziukėnas)How to keep calm and ship it (Juozas Kaziukėnas)
How to keep calm and ship it (Juozas Kaziukėnas)
Ā 
Phone gap
Phone gapPhone gap
Phone gap
Ā 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
Ā 
Innovating the other web - #wrocsharp keynote
Innovating the other web - #wrocsharp keynote Innovating the other web - #wrocsharp keynote
Innovating the other web - #wrocsharp keynote
Ā 
Advancing Content Management for Omni-Channel User Experiences by Roland Bene...
Advancing Content Management for Omni-Channel User Experiences by Roland Bene...Advancing Content Management for Omni-Channel User Experiences by Roland Bene...
Advancing Content Management for Omni-Channel User Experiences by Roland Bene...
Ā 

Viewers also liked

Kayla Horbacz Resume
Kayla Horbacz ResumeKayla Horbacz Resume
Kayla Horbacz Resume
Kayla Horbacz
Ā 
Mark Tortorici "The Technology Stack"
Mark Tortorici "The Technology Stack"Mark Tortorici "The Technology Stack"
Mark Tortorici "The Technology Stack"
Talent42
Ā 
Tratamientos corporales Andrea Osorio Vargas estƩtica facial y corporal
Tratamientos corporales Andrea Osorio Vargas estƩtica facial y corporalTratamientos corporales Andrea Osorio Vargas estƩtica facial y corporal
Tratamientos corporales Andrea Osorio Vargas estƩtica facial y corporal
AOVESTETICA
Ā 
Dale draggoo resume m read only
Dale draggoo resume m read onlyDale draggoo resume m read only
Dale draggoo resume m read only
dfdraggoo
Ā 
AlexLu_Resume
AlexLu_ResumeAlexLu_Resume
AlexLu_Resume
Alex Lu
Ā 
Click here to download my CV in Word format.doc
Click here to download my CV in Word format.docClick here to download my CV in Word format.doc
Click here to download my CV in Word format.doc
butest
Ā 
Accounting solved mcqs
Accounting solved mcqsAccounting solved mcqs
Accounting solved mcqs
lucky1671
Ā 
Tarun hait cv
Tarun hait cvTarun hait cv
Tarun hait cv
Tarun Hait
Ā 

Viewers also liked (20)

Mphasis php & .net
Mphasis php & .net   Mphasis php & .net
Mphasis php & .net
Ā 
K.Hutchins Resume
K.Hutchins ResumeK.Hutchins Resume
K.Hutchins Resume
Ā 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developers
Ā 
Kayla Horbacz Resume
Kayla Horbacz ResumeKayla Horbacz Resume
Kayla Horbacz Resume
Ā 
PHPUnit from a developer's perspective
PHPUnit from a developer's perspectivePHPUnit from a developer's perspective
PHPUnit from a developer's perspective
Ā 
Mark Tortorici "The Technology Stack"
Mark Tortorici "The Technology Stack"Mark Tortorici "The Technology Stack"
Mark Tortorici "The Technology Stack"
Ā 
CV LinkedIn
CV LinkedInCV LinkedIn
CV LinkedIn
Ā 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developers
Ā 
Contorno corporal
Contorno corporalContorno corporal
Contorno corporal
Ā 
Tratamientos corporales Andrea Osorio Vargas estƩtica facial y corporal
Tratamientos corporales Andrea Osorio Vargas estƩtica facial y corporalTratamientos corporales Andrea Osorio Vargas estƩtica facial y corporal
Tratamientos corporales Andrea Osorio Vargas estƩtica facial y corporal
Ā 
Dale draggoo resume m read only
Dale draggoo resume m read onlyDale draggoo resume m read only
Dale draggoo resume m read only
Ā 
Hipotonia y Flacidez
Hipotonia y Flacidez Hipotonia y Flacidez
Hipotonia y Flacidez
Ā 
Resume
ResumeResume
Resume
Ā 
AlexLu_Resume
AlexLu_ResumeAlexLu_Resume
AlexLu_Resume
Ā 
My Resume
My ResumeMy Resume
My Resume
Ā 
Portafolio centro de medicina estetica
Portafolio centro de medicina esteticaPortafolio centro de medicina estetica
Portafolio centro de medicina estetica
Ā 
Resume--Alpheus E Madsen
Resume--Alpheus E MadsenResume--Alpheus E Madsen
Resume--Alpheus E Madsen
Ā 
Click here to download my CV in Word format.doc
Click here to download my CV in Word format.docClick here to download my CV in Word format.doc
Click here to download my CV in Word format.doc
Ā 
Accounting solved mcqs
Accounting solved mcqsAccounting solved mcqs
Accounting solved mcqs
Ā 
Tarun hait cv
Tarun hait cvTarun hait cv
Tarun hait cv
Ā 

Similar to Mobile for PHP developers

HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
davyjones
Ā 
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
Ugly truths about html5   moosecon - robert virkus - 2013-03-07Ugly truths about html5   moosecon - robert virkus - 2013-03-07
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
Enough Software
Ā 
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Bala Subra
Ā 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10
Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10
Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10
Niklas Heidloff
Ā 
Creating Next-Generation ADF Mobile Applications
Creating Next-Generation ADF Mobile ApplicationsCreating Next-Generation ADF Mobile Applications
Creating Next-Generation ADF Mobile Applications
Brian Huff
Ā 
Philly ete-2011
Philly ete-2011Philly ete-2011
Philly ete-2011
davyjones
Ā 
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
jward5519
Ā 
Html5 mobile develop tools
Html5 mobile develop toolsHtml5 mobile develop tools
Html5 mobile develop tools
Ley Liu
Ā 

Similar to Mobile for PHP developers (20)

Mobile Web & HTML5 Performance Optimization
Mobile Web & HTML5 Performance OptimizationMobile Web & HTML5 Performance Optimization
Mobile Web & HTML5 Performance Optimization
Ā 
iOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3cityiOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3city
Ā 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
Ā 
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
Ugly truths about html5   moosecon - robert virkus - 2013-03-07Ugly truths about html5   moosecon - robert virkus - 2013-03-07
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
Ā 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
Ā 
Drupalcamp New York 2009
Drupalcamp New York 2009Drupalcamp New York 2009
Drupalcamp New York 2009
Ā 
Siruna session at Drupalcon Paris 2009
Siruna session at Drupalcon Paris 2009Siruna session at Drupalcon Paris 2009
Siruna session at Drupalcon Paris 2009
Ā 
Building Mobile Websites with Joomla
Building Mobile Websites with JoomlaBuilding Mobile Websites with Joomla
Building Mobile Websites with Joomla
Ā 
PhoneGap at Facebook Mobile Hack
PhoneGap at Facebook Mobile HackPhoneGap at Facebook Mobile Hack
PhoneGap at Facebook Mobile Hack
Ā 
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Ā 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10
Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10
Mobile Controls for IBM Lotus Domino XPages on OpenNTF 09/10
Ā 
Creating Next-Generation ADF Mobile Applications
Creating Next-Generation ADF Mobile ApplicationsCreating Next-Generation ADF Mobile Applications
Creating Next-Generation ADF Mobile Applications
Ā 
Introduction to Android
Introduction to AndroidIntroduction to Android
Introduction to Android
Ā 
Philly ete-2011
Philly ete-2011Philly ete-2011
Philly ete-2011
Ā 
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Ā 
Hybridmobileapps 130130213844-phpapp02
Hybridmobileapps 130130213844-phpapp02Hybridmobileapps 130130213844-phpapp02
Hybridmobileapps 130130213844-phpapp02
Ā 
Html5 mobile develop tools
Html5 mobile develop toolsHtml5 mobile develop tools
Html5 mobile develop tools
Ā 
Mobile Web High Performance
Mobile Web High PerformanceMobile Web High Performance
Mobile Web High Performance
Ā 
Txjs
TxjsTxjs
Txjs
Ā 
Phonegap 1.0
Phonegap 1.0Phonegap 1.0
Phonegap 1.0
Ā 

More from Ivo Jansch

More from Ivo Jansch (20)

Own Your Apps
Own Your Apps Own Your Apps
Own Your Apps
Ā 
PHP Development In The Cloud (php|tek edition)
PHP Development In The Cloud (php|tek edition)PHP Development In The Cloud (php|tek edition)
PHP Development In The Cloud (php|tek edition)
Ā 
Building an SSO platform in PHP (Zend Webinar Edition)
Building an SSO platform in PHP (Zend Webinar Edition)Building an SSO platform in PHP (Zend Webinar Edition)
Building an SSO platform in PHP (Zend Webinar Edition)
Ā 
The Business Case For Telecommuting
The Business Case For TelecommutingThe Business Case For Telecommuting
The Business Case For Telecommuting
Ā 
PHP in a mobile ecosystem
PHP in a mobile ecosystem PHP in a mobile ecosystem
PHP in a mobile ecosystem
Ā 
27 Ways To Be A Better Developer (PHPBenelux 2011)
27 Ways To Be A Better Developer (PHPBenelux 2011)27 Ways To Be A Better Developer (PHPBenelux 2011)
27 Ways To Be A Better Developer (PHPBenelux 2011)
Ā 
Building an SSO platform in php (Zendcon 2010)
Building an SSO platform in php (Zendcon 2010)Building an SSO platform in php (Zendcon 2010)
Building an SSO platform in php (Zendcon 2010)
Ā 
PHP in a Mobile Ecosystem (Zendcon 2010)
PHP in a Mobile Ecosystem (Zendcon 2010)PHP in a Mobile Ecosystem (Zendcon 2010)
PHP in a Mobile Ecosystem (Zendcon 2010)
Ā 
PHP and the Cloud (phpbenelux conference)
PHP and the Cloud (phpbenelux conference)PHP and the Cloud (phpbenelux conference)
PHP and the Cloud (phpbenelux conference)
Ā 
Content Management Selection and Strategy
Content Management Selection and StrategyContent Management Selection and Strategy
Content Management Selection and Strategy
Ā 
PHP and the Cloud
PHP and the CloudPHP and the Cloud
PHP and the Cloud
Ā 
PHP in the Real World
PHP in the Real WorldPHP in the Real World
PHP in the Real World
Ā 
Dynamic Languages In The Enterprise (4developers march 2009)
Dynamic Languages In The Enterprise (4developers march 2009)Dynamic Languages In The Enterprise (4developers march 2009)
Dynamic Languages In The Enterprise (4developers march 2009)
Ā 
Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)
Ā 
Enterprise PHP Development - ZendCon 2008
Enterprise PHP Development - ZendCon 2008Enterprise PHP Development - ZendCon 2008
Enterprise PHP Development - ZendCon 2008
Ā 
Enterprise PHP Development (Dutch PHP Conference 2008)
Enterprise PHP Development (Dutch PHP Conference 2008)Enterprise PHP Development (Dutch PHP Conference 2008)
Enterprise PHP Development (Dutch PHP Conference 2008)
Ā 
Hello Enterprise, my name is PHP
Hello Enterprise, my name is PHPHello Enterprise, my name is PHP
Hello Enterprise, my name is PHP
Ā 
Introduction to PHP (Casino Affiliate Convention 2008)
Introduction to PHP (Casino Affiliate Convention 2008)Introduction to PHP (Casino Affiliate Convention 2008)
Introduction to PHP (Casino Affiliate Convention 2008)
Ā 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
Ā 
Maatwerk Software
Maatwerk SoftwareMaatwerk Software
Maatwerk Software
Ā 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(ā˜Žļø+971_581248768%)**%*]'#abortion pills for sale in dubai@
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Ā 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Ā 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
Ā 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Ā 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Ā 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Ā 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Ā 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Ā 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Ā 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Ā 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
Ā 

Mobile for PHP developers

  • 1. http://www.egeniq.com info@egeniq.com @egeniq Mobile for PHP Developers a 3 hour primer Ivo Jansch php|tek, May 2011
  • 4. Contents ā€£ Part 1: Putting mobile in perspective ā€£ Part 2: Browser based mobile applications ā€£ Part 3: A few words on frontend design ā€£ Part 4: Cool stuff with PHP and native apps ā€£ Part 5: APIs for native apps ā€£ Part 6: Web vs Native: best of both worlds ā€£ Part 7: Random bits if time permits 4
  • 5. Part 1 Letā€™s think about mobile for a few minutes 5
  • 7. Itā€™s revolutionary Much like when the phone lost its wall socket 7
  • 8. The Internet Of Things ivo-imac:~ ivo$ ping fridge PING fridge (192.168.1.138): 56 data bytes 8
  • 9. The Web versus The Internet 9
  • 10. Usage Characteristics ā€£ On the go ā€£ Short attention span ā€£ Avoid typing ā€£ To the point / ad hoc ā€£ Omnipresent ā€£ Context Awareness 10
  • 12. Usage - ā€˜Couch Computingā€™ ā€£ Relaxed ā€£ Freedom ā€£ Consumption ā€£ Convergence ā€£ Companion 12
  • 13. Mobile Technologies ā€£ Objective-C (iPhone, iPad, iPod Touch, Apple TV) ā€£ Java (Android, Blackberry, Symbian) ā€£ HTML5 / Javascript (Any) ā€£ PHP (Any) 13
  • 14. The App vs. The Browser 14
  • 15. Browser based applications ā€£ Write once, run anywhere ā€£ Online ā€£ Requires browser ā€£ Page based ā€£ ā€˜Statelessā€™ 15
  • 16. Native Apps ā€£ On- and offline ā€£ Event based ā€£ Native device experience ā€£ Convenient access to device features ā€£ Stateful ā€£ Monetization through App Stores 16
  • 17. Some statistics ā€£ Android Market: 100.000 apps ā€£ Apple App Store: 300.000 apps ā€£ Web: 3.000.000 websites optimized for mobile Sources: ā€£ http://www.bizreport.com/2010/10/dotmobi-2000-growth-in-number-of-mobile-ready-websites.html# ā€£ http://twitter.com/AndroidDev/status/28701488389 ā€£ http://www.silobreaker.com/apples-app-store-crosses-300000-apps-5_2263799272514256896 17
  • 19. Part 2 Browser Based Mobile Apps 19
  • 20. 10 years ago Source: freewebmasterhelp.com 20
  • 21. A little over 4 years ago Source: Mobiforge.com 21
  • 23. Dealing with a smaller screen 2 ways to render a regular website: ā€£ Keyhole ā€£ Scaled 23
  • 24. Keyhole 24
  • 25. Scaled 25
  • 26. A pixel is not a pixel 640 1020 26
  • 27. A pixel is not a pixel Viewports: ā€£ Invented by Apple ā€£ Adopted by others ā€£ Unofficial standard, registered at whatwg.org 27
  • 28. A pixel is not a pixel 320 640 480 960 iPhone 3 iPhone 4 28
  • 29. A pixel is not a pixel CSS 2.1 Specification: ā€œIf the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values. It is recommended that the pixel unit refer to the whole number of device pixels that best approximates the reference pixel. It is recommended that the reference pixel be the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an armā€™s length.ā€ 29
  • 30. Standardization Horror ā€£ <meta name=ā€viewportā€ content=ā€width=device-widthā€ /> ā€¢ iPhone and most others ā€£ <meta name=ā€HandheldFriendlyā€ content=ā€trueā€ /> ā€¢ Many feature phones (originally Palm) ā€£ <meta name=ā€MobileOptimizedā€ content=ā€320ā€ /> ā€¢ Windows Mobile ā€£ <meta name=ā€viewportā€ content=ā€target-densitydpi=device-dpiā€ /> ā€¢ Android 30
  • 31. A pixel is not a pixel Recommended reading: http://www.quirksmode.org/blog/ by Peter Paul Koch 31
  • 32. Device Detection Itā€™s all in the User Agent ā€¢ Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version / 4.0.5 Mobile/8B117 Safari/6531.22.7 ā€¢ Mozilla/5.0 (Linux; U; Android 2.1-update1; nl-nl; HTC Hero Build/ERE27) AppleWebKit/ 530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/ 530.17 32
  • 34. Donā€™t Reinvent The Wheel http://detectmobilebrowsers.mobi/ ā€¢ Downloadable PHP library for device detection ā€¢ Online code generator ā€¢ Donationware ā€¢ Ugly code, well documented 34
  • 35. On to a more advanced mechanism ā€£ General tip: ā€¢ donā€™t rely on device ā€¢ rely on capabilities ā€£ WURFL ā€¢ Wireless Universal Resource FiLe ā€¢ Contains info on 500+ capabilities of 14.000+ devices ā€¢ http://wurfl.sourceforge.net/ ā€¢ Clients available for many languages 35
  • 36. WURFL in PHP: Tera-Wurfl ā€£ Download Tera-Wurfl ā€¢ http://www.tera-wurfl.com ā€£ Install in document root ā€¢ e.g. in /var/www/yoursite/Tera-WURFL ā€¢ Make sure data/ dir is apache read+writable ā€£ Create empty database 36
  • 37. Tera-WURFL Setup ā€£ Copy TeraWurflConfig.php.example ā€¢ Edit database settings ā€£ Browse to: ā€¢ http://yoursite/Tera-Wurfl/admin/install.php 37
  • 46. Alternatives ā€£ http://www.deviceatlas.com ā€¢ Commercial database of device properties ā€¢ Available online, as API and downloadable json file ā€¢ Free for development ā€¢ ~99$/year for production 46
  • 47. Browser Detection In Practice ā€£ Letā€™s optimize a site with what weā€™ve learned so far. ā€£ Letā€™s take advantage of ZFā€™s powerful MVC set up ā€¢ View scripts determine layout of actions ā€¢ Layout script wraps everything into main layout ā€¢ Use Bootstrapper to detect device and setup MVC 47
  • 48. Zend Framework mobile site 2 ways for mobile layout: ā€£ Separate files ā€£ Separate folders Detection in bootstrap 48
  • 52. Result Try it at http://egeniq.com/demo/zf/public 52
  • 53. Zend_Http_UserAgent ā€£ New in Zend Framework 1.11 ā€£ Can work with WURFL or Device Atlas 53
  • 54. Dealing With Mobile Browsers ā€£ Considerations: ā€¢ Donā€™t redirect to homepage ā€¢ Offer ā€˜classicā€™ option ā€¢ Donā€™t make assumptions on physical screen size 54
  • 55. Part 3 A few words on front end design 55
  • 56. UI Design ā€£ Hover = evil ā€£ ā€˜Finger Friendly Designā€™ ā€£ ā€˜Touch Driven Developmentā€™ ā€£ Screens are getting bigger and (!) smaller 56
  • 58. HTML5 is easy ā€£ <!doctype html> - period. ā€£ <script> or <style> - period. ā€£ Semantics: header, footer, section, article tags 58
  • 59. HTML5 is powerful ā€£ localStorage ā€£ <video> ā€£ <canvas> ā€£ <svg> ā€£ <input type=ā€numberā€> and many other form fields ā€£ navigator.geolocation.getCurrentPosition(); 59
  • 60. Browsers love HTML5 Browsers supporting HTML5: ā€£ Firefox ā€£ Safari ā€£ Opera ā€£ All the mobile browsers ā€£ IE (sort of, no support for <article> until IE9) 60
  • 61. Things to consider ā€£ Donā€™t just scale the layout, scale content too ā€£ Consider ā€˜scenario based content managementā€™ 61
  • 62. jQTouch 62
  • 63. jQTouch ā€£ iPhone experience in HTML5 ā€£ http://jqtouch.com/ (beta 3) ā€£ jQuery based ā€£ MIT License ā€£ Give it a try: http://jqtouch.com/preview/ demos/main 63
  • 64. Alternatives ā€£ jQuery Mobile ā€¢ 1.0 alpha was released at October 16, 2010 ā€¢ http://jquerymobile.com/ ā€£ Sencha Touch ā€¢ From the makers of jqTouch ā€¢ Tablet support ā€¢ http://www.sencha.com/products/touch/ 64
  • 65. Simple tricks Making phone calls from a web page: 65
  • 66. Simple tricks Open Maps application: 66
  • 67. You already know PHP Your PHP skills + HTML5 = easy mobile websites 67
  • 68. Part 4 Doing Cool Stuff With PHP And Native Apps 68
  • 73. Tiqr demo ā€£ Authentication with a smart phone ā€£ Components ā€¢ Client: iPhone, Android ā€¢ Server: Zend Framework, simpleSAMLphp or plain PHP ā€¢ Standards: OATH OCRA, SHA-x, HOTP, SAML ā€¢ License: BSD ā€£ http://www.tiqr.org 73
  • 76. Device Notifications ā€£ A way to get attention ā€£ Use with caution 76
  • 77. Notifications ā€£ Apple ā€¢ Push Notifications ā€¢ http://code.google.com/p/apns-php/ ā€£ Android ā€¢ Cloud To Device Messaging (c2dm) ā€¢ https://github.com/mwillbanks/ Zend_Service_Google_C2dm/ ā€£ BlackBerry ā€¢ BlackBerry Push Service ā€¢ CURL 77
  • 78. Notifications Apple Push Your Server Notiļ¬cation deviceToken message message Services payload payload signature Your App 78
  • 82. Notifications - Notes ā€£ For Apple: ā€¢ Get certificates from the developer portal ā€£ For Android ā€¢ Need to register an account and request a quota ā€£ Note: deviceTokens can change! 82
  • 83. Token Exchange notiļ¬cationToken Apple Push Your Server Notiļ¬cation deviceToken message message Services payload payload signature Your App notiļ¬cationToken deviceToken deviceToken Token notiļ¬cationToken Exchange http://tokenexchange.googlecode.com 83
  • 84. Part 5 APIs for Native Apps 84
  • 85. PHPā€™s role in native apps Android Blackberry iPhone App App App API 85
  • 86. Optimize APIs for mobile ā€£ Content optimization ā€£ Scalability ā€£ Longevity ā€£ Security ā€£ Client/Server considerations 86
  • 87. Content Optimization ā€£ Consider CPU and memory constraints ā€¢ Prefer JSON over XML ā€¢ Compress data ā€¢ Keep responses small ā€¢ But not too small (connection / routing overhead) 87
  • 88. Scalability ā€£ AppStore featured/top listings Slashdot effect ā€£ Consider the 80/20 rule of app popularity though 88
  • 89. Longevity ā€£ Apps have different deployment patterns ā€¢ No ā€˜quick fixā€™ in the application as in web apps ā€£ Client/Server asynchronous updates ā€¢ Backwards compatibility ā€£ Versioned API URLs: - http://iportfolio.api.egeniq.com/portfolios/1.0/mvb/collections.json 89
  • 90. Longevity ā€£ How long do you support your APIs? ā€¢ Canā€™t force people to delete their Apps ā€¢ Provide clean fallback ā€¢ Synchronized instead of real-time data ā€£ Implement status check API calls ā€£ API ownership 90
  • 91. Longevity - API Ownership ā€£ Own DNS records ā€£ Own the initial entry point of the app ā€£ Donā€™t hardcode URLs ā€£ By the way: also own the developer account 91
  • 92. API Security ā€£ TLS/SSL ā€£ Basic Auth ā€£ OAuth? XAuth! ā€£ PKI / TLSAuth ā€£ Signed URLs 92
  • 93. Signed URLs ā€£ Prevent parameter tampering ā€£ Allow API use by specific client only ā€£ Simple but effective way to protect API 93
  • 94. Signed URLs Params + Signature Client API Sign Params Verify With Signature Signature W 94
  • 95. Signed URLs W 95
  • 96. Signed URLs W 96
  • 97. Signed URLs W 97
  • 98. Client/Server considerations ā€£ Image Processing in the API, instead of App ā€¢ Use Imagick / GD etc. ā€¢ Trade-off between bandwidth and processing power ā€£ Apps support threading / asynchronisity ā€¢ Fire-and-forget API design ā€¢ Prepare/getResult call duos ā€£ Push features into PHP APIs for reuse 98
  • 99. PHPā€™s role in native apps ā€£ PHP has native support for: ā€¢ Web services ā€¢ JSON ā€¢ Compression ā€¢ Image manipulation ā€£ Egeniqā€™s number 1 choice for App APIs ā€£ 25-30% of App development time = API 99
  • 100. Part 6 Web vs Native: Best of Both Worlds 100
  • 101. HTML5 in the App Store ā€£ HTML5 on the server, supports PHP: ā€¢ IPFaces - http://www.ipfaces.org/ ā€£ HTML5 on the device, no (or limited) support for PHP: ā€¢ AppCelerator - http://appcelerator.com/ ā€¢ Phonegap - http://phonegap.com 101
  • 102. Cross Compilers = Instant Coffee 102
  • 103. Part 7 Random bits if time permits 103
  • 104. Testing ā€£ Various options for testing: ā€¢ Get your boss to buy you devices ā€¢ Firefox with user agent plugin ā€¢ Use Simulators/Emulators ā€¢ Use a service such as DeviceAnywhere 104
  • 105. Running PHP on the device First: Why??! ā€£ PHP For Android (PFA) ā€¢ http://phpforandroid.net/ ā€£ PAMP for Symbian ā€¢ http://wiki.opensource.nokia.com/projects/PAMP 105
  • 106. Symfony Mobile ā€¢ Mime-type based optimisation ā€¢ http://www.symfony-project.org/blog/2008/06/09/how- to-create-an-optimized-version-of-your-website-for-the- iphone-in-symfony-1-1 106
  • 108. Resources for PHP/Mobile ā€¢ http://www.egeniq.com/blog ā€¢ http://mobile.phpmagazine.net/ ā€¢ http://thoomtech.com/iphone/ objc-for-php-developers-part-1/ 108
  • 109. http://www.egeniq.com info@egeniq.com @egeniq Thank you! Questions? http://joind.in/3412 http://www.egeniq.com ivo@egeniq.com @ijansch
  • 110. Credits Pictures used in this presentation are creative commons attribution licensed pictures. Here are the owners and the URLS where the originals can be found: ā€˜Dow says POOā€™ by Stepleton - http://www.flickr.com/photos/29407923@N03/2899705638/ ā€˜The telephoneā€™ by Tylerdurden - http://www.flickr.com/photos/tylerdurden/529028040/ ā€˜Webā€™ by Kurtxio - http://www.flickr.com/photos/kurtxio/2182760200/ ā€˜Heavy cloud, no rainā€™ by Robynsnest - http://www.flickr.com/photos/robynsnest/12405841/ ā€˜Wireless fridgeā€™ from http://www.wirelessgoodness.com/tag/srt746awtn/ ā€˜Army iphone appā€™ by Soldiersmediacenter - http://www.flickr.com/photos/soldiersmediacenter/4271795260/ ā€˜Carbon Fibre Walletā€™ by Ryan Loos - http://www.flickr.com/photos/rh1n0/4157547404/ ā€˜Keysā€™ by Jamison Judd - http://www.flickr.com/photos/jamisonjudd/2419601050/ ā€˜Phone Girlā€™ by Steffen - http://www.flickr.com/photos/re-ality/460465894/ ā€˜Icon_safari_hiresā€™ by Hans Dorsch - http://www.flickr.com/photos/hansdorsch/2861804087/ ā€˜Thinkingā€™ by Karola - http://www.flickr.com/photos/karola/3623768629/ ā€˜Jus'a webā€™ by Jusfi - http://www.flickr.com/photos/jusfi/2921202536/ ā€˜iPad :)ā€™ by Korosirego - http://www.flickr.com/photos/korosirego/4334862666/ ā€˜I've got a monkey on my backā€™ by Keven Law - http://www.flickr.com/photos/kevenlaw/2698946160/ ā€˜Add a spoonful of coffeeā€™ by Martyn Wright - http://www.flickr.com/photos/35521221@N05/5181647830/ ā€˜Locked steelā€™ by Darwinbell - http://www.flickr.com/photos/darwinbell/321434733/ ā€˜4 Biscuitsā€™ by Barnoid - http://www.flickr.com/photos/barnoid/2025811494/ ā€˜pining for mauiā€™ by Dā€™Arcy Norman - http://www.flickr.com/photos/dnorman/2223663304/
  • 111. Credits Pictures used in this presentation are creative commons attribution licensed pictures. Here are the owners and the URLS where the originals can be found: ā€˜Seeing my world through a keyholeā€™ by Kate Ter Haar - http://www.flickr.com/photos/katerha/4592429363/ ā€˜Dear CNN, please send me push notifi...ā€™ by Alex Valentine - http://www.flickr.com/photos/alexvalentine/5644423659/ Ivoā€™s portrait in intro, photo by Jelmer de Haas - http://www.jelmerdehaas.com