SlideShare a Scribd company logo
Submit Search
Upload
Login
Signup
PHP goes mobile
Report
Enrico Zimuel
Follow
Senior Software Engineer at Zend Technologies
Apr. 16, 2012
•
0 likes
•
3,305 views
1
of
24
PHP goes mobile
Apr. 16, 2012
•
0 likes
•
3,305 views
Download Now
Download to read offline
Report
Investor Relations
Technology
Sviluppo di applicazioni web mobile con Zend Framework
Enrico Zimuel
Follow
Senior Software Engineer at Zend Technologies
Recommended
Zend Framework 2
Enrico Zimuel
3.5K views
•
61 slides
Framework software e Zend Framework
Enrico Zimuel
1.1K views
•
28 slides
Velocizzare Joomla! con Zend Server Community Edition
Enrico Zimuel
2K views
•
29 slides
Integrare Zend Framework in Wordpress
Enrico Zimuel
6.6K views
•
38 slides
Il Pattern di Zend Framework 2
Zend by Rogue Wave Software
1.3K views
•
58 slides
Il testing con zend framework
Zend by Rogue Wave Software
595 views
•
51 slides
More Related Content
Viewers also liked
XCheck a benchmark checker for XML query processors
Enrico Zimuel
819 views
•
32 slides
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Enrico Zimuel
1.9K views
•
15 slides
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Enrico Zimuel
3.5K views
•
34 slides
La sicurezza delle applicazioni in PHP
Enrico Zimuel
430 views
•
29 slides
Introduzione alla crittografia
Enrico Zimuel
730 views
•
41 slides
Crittografia quantistica: fantascienza o realtà?
Enrico Zimuel
763 views
•
29 slides
Viewers also liked
(20)
XCheck a benchmark checker for XML query processors
Enrico Zimuel
•
819 views
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Enrico Zimuel
•
1.9K views
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Enrico Zimuel
•
3.5K views
La sicurezza delle applicazioni in PHP
Enrico Zimuel
•
430 views
Introduzione alla crittografia
Enrico Zimuel
•
730 views
Crittografia quantistica: fantascienza o realtà?
Enrico Zimuel
•
763 views
Introduzione alle tabelle hash
Enrico Zimuel
•
662 views
Enrico Zimuel: La sicurezza delle applicazioni in PHP
Francesco Fullone
•
1.3K views
Crittografia è sinonimo di sicurezza?
Enrico Zimuel
•
647 views
L'ABC della crittografia
Giovanni Bechis
•
4.1K views
Sesta parte sicurezza_in_rete
Zilli Emilio
•
642 views
How does TOR work and what is the DeepWeb
Gianluca Gabrielli
•
2.7K views
Cryptography with Zend Framework
Enrico Zimuel
•
3.3K views
Crittografia
FRANCA SORMANI
•
387 views
Crittografia
Andrea Gottardi
•
7K views
Principi di crittografia
peppespe
•
4.3K views
Crittografia
Mionome
•
3.5K views
Cryptography in PHP: use cases
Enrico Zimuel
•
14.5K views
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Enrico Zimuel
•
1.9K views
Strong cryptography in PHP
Enrico Zimuel
•
5.7K views
Similar to PHP goes mobile
Il testing con zend framework
Zend by Rogue Wave Software
543 views
•
51 slides
Case study: un approccio modulare in un progetto legacy
Mariano Fiorentino
849 views
•
21 slides
Non Conventional Android Programming (Italiano)
Davide Cerbo
1.2K views
•
36 slides
Come sviluppare applicazioni cross device con HTML
Sinergia Totale
1.3K views
•
34 slides
Pro php refactoring
Francesco Trucchia
645 views
•
30 slides
Slide Mulesoft Meetup Milano #10.pdf
Florence Consulting
133 views
•
85 slides
Similar to PHP goes mobile
(20)
Il testing con zend framework
Zend by Rogue Wave Software
•
543 views
Case study: un approccio modulare in un progetto legacy
Mariano Fiorentino
•
849 views
Non Conventional Android Programming (Italiano)
Davide Cerbo
•
1.2K views
Come sviluppare applicazioni cross device con HTML
Sinergia Totale
•
1.3K views
Pro php refactoring
Francesco Trucchia
•
645 views
Slide Mulesoft Meetup Milano #10.pdf
Florence Consulting
•
133 views
App Engine + Python
Simone Marzola
•
727 views
Csp@scuola smarttv corso1
CSP Scarl
•
446 views
Sicurezza Php (giugno 2010) Stefano Bianchini presso Ce.Se.N.A.
Stefano Bianchini
•
194 views
Whymca nfc presentation
Myti S.r.l.
•
448 views
Android - ishan fernando - android nfc presentation
Whymca
•
886 views
Whymca nfc presentation
Myti S.r.l.
•
384 views
Hexagonal architecture ita
Alessandro Minoccheri
•
162 views
Simple Cloud API: accesso semplificato al cloud computing
Francesca1980
•
655 views
Codice efficiente per le Windows Store Apps by Matteo Anelli
Codemotion
•
581 views
Alla scoperta di Zend Framework 1.8
massimiliano.wosz
•
633 views
Il Web orientato al futuro: Express, Angular e nodeJS
Eugenio Minardi
•
4.3K views
Programmazione mobile: ANDROID
Paolo Tosato
•
933 views
introduzione a symfony 2
Riccardo Franconi
•
935 views
WEBdeBS NFC Presentation
Myti S.r.l.
•
484 views
More from Enrico Zimuel
Password (in)security
Enrico Zimuel
10.3K views
•
38 slides
Quick start on Zend Framework 2
Enrico Zimuel
12.5K views
•
42 slides
A quick start on Zend Framework 2
Enrico Zimuel
16.5K views
•
52 slides
Zend Framework 2 quick start
Enrico Zimuel
9.6K views
•
45 slides
How to scale PHP applications
Enrico Zimuel
29.5K views
•
39 slides
Zend_Cache: how to improve the performance of PHP applications
Enrico Zimuel
6.4K views
•
29 slides
More from Enrico Zimuel
(10)
Password (in)security
Enrico Zimuel
•
10.3K views
Quick start on Zend Framework 2
Enrico Zimuel
•
12.5K views
A quick start on Zend Framework 2
Enrico Zimuel
•
16.5K views
Zend Framework 2 quick start
Enrico Zimuel
•
9.6K views
How to scale PHP applications
Enrico Zimuel
•
29.5K views
Zend_Cache: how to improve the performance of PHP applications
Enrico Zimuel
•
6.4K views
Sviluppo di applicazioni sicure
Enrico Zimuel
•
389 views
Misure minime di sicurezza informatica
Enrico Zimuel
•
689 views
PHP e crittografia
Enrico Zimuel
•
550 views
Firma digitale
Enrico Zimuel
•
600 views
PHP goes mobile
1.
Sviluppo di applicazioni
web mobile con Zend Framework Enrico Zimuel Senior PHP Engineer, Zend Technologies Zend Framework Core Team PHP goes mobile, 13 Aprile 2012 http://mobilephp.grusp.org/ © All rights reserved. Zend Technologies, Inc.
2.
Chi sono
● Software Engineer dal 1996 (1984?) ▶ Assembly, Basic, C/C++, Java, Perl, PHP ● PHP Engineer e Software Architect presso Zend Technologies dal 2008 ● Zend Framework Core Team dal 2011 ● Research Programmer presso l'Informatics Institute dell'Università di Amsterdam ● Co-autore del libro “PHP best practices” FAG edizioni (in corso di pubblicazione) © All rights reserved. Zend Technologies, Inc.
3.
Web mobile vs.
Native App © All rights reserved. Zend Technologies, Inc.
4.
Web mobile vs.
Native App Web mobile Native App Accesso al limitato totale dispositivo Velocità buona ottima Costi sviluppo bassi medio/alti Tecnologia open si a volte Ricavi 100% dipende Approvazione nessuna dipende Tempi di rilascio immediati 1-2 settimane Linguaggio di HTML e qualsiasi dipende programmazione altro (esempio PHP) © All rights reserved. Zend Technologies, Inc.
5.
Web mobile vs.
Native App (2) “People never cared about the Web vs. apps and devices . . . They want free stuff, entertainment, and services when they want them, and on the device they have in front of them” Fonte: Pew Internet Project (Marzo, 2012) © All rights reserved. Zend Technologies, Inc.
6.
Web mobile con
ZF © All rights reserved. Zend Technologies, Inc.
7.
Zend Framework ●
Framework PHP per lo sviluppo di applicazioni web ▶ > 10 milioni di download ▶ > 500 sviluppatori ▶ > 10 milioni hits su Google ● Open source, licenza basata su new BSD ● Versioni: 1.11.11 (PHP 5.2) e 2.0.0.beta3 (PHP 5.3+) ● Sito del progetto: http://framework.zend.com ● © Zend Technologies Ltd. © All rights reserved. Zend Technologies, Inc.
8.
Zend Technologies ●
Zend Technologies Ltd, the PHP Company ● Fondata nel 1999 da Andi Gutmans e Zeev Suraski, gli sviluppatori del PHP 3.0 ● Quartier generale nella Silicon Valley a Cupertino (USA) ● Uffici in: Francia, Germania, India, Irlanda, Israele, Italia ● © PHP Engine 2 (l'interprete del PHP) ● Sito: http://www.zend.com © All rights reserved. Zend Technologies, Inc.
9.
Componenti ZF per
il web mobile ● Zend_Http_UserAgent ▶ BrowsCap ▶ Tera-WURFL ▶ DeviceAtlas ● Context Switching ● Zend_Mobile ▶ Disponibile dalla versione 1.12 di ZF © All rights reserved. Zend Technologies, Inc.
10.
BrowsCap ●
Funzione get_browser() del PHP ● Configurazione: ▶ Download del file browscap.ini dal sito del progetto Browser Capabilities: http://browsers.garykeith.com/downloads ▶ Configurare php.ini con la direttiva: browscap=/path/to/browscap.ini © All rights reserved. Zend Technologies, Inc.
11.
Tera-WURFL ●
Tera-WURFL è una libreria in PHP e un database in MySQL/MSSQL/MongoDB di informazioni su device ● Download: http://dbapi.scientiamobile.com © All rights reserved. Zend Technologies, Inc.
12.
DeviceAtlas ●
Libreria disponibile per diversi linguaggi (PHP, Java, .NET, Python, Ruby) per il riconoscimento di mobile device ● Download: http://deviceatlas.com/resourcecentre/get+started/enterprise+api © All rights reserved. Zend Technologies, Inc.
13.
Zend_Http_UserAgent ●
Utilizzato per identificare il device dell'utente ● Utilizzabile in diversi punti di un'applicazione ZF ▶ Plugin (bootstrap) ▶ Controller ▶ View © All rights reserved. Zend Technologies, Inc.
14.
Zend_Http_UserAgent (2) ●
Plugin (bootstrap) ▶ $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); $userAgent = $bootstrap->getResource('useragent'); ● Controller ▶ $bootstrap = $this->getInvokeArg('bootstrap'); $userAgent = $bootstrap->getResource('useragent'); ● View ▶ $userAgent = $this->userAgent(); © All rights reserved. Zend Technologies, Inc.
15.
Alcuni metodi dell'UserAgent ●
getDevice() ● getBrowserType() ● getAllFeatures() ● hasFlashSupport() ● hasPdfSupport() ● hasPhoneNumber() ● httpsSupport() ● getMaxImageHeight() ● getMaxImageWidth() ● ... © All rights reserved. Zend Technologies, Inc.
16.
Context switching ●
ContextSwitching è un action helper che consente di definire risposte differenti a seconda del contesto (della richiesta) ● E' di solito utilizzato nei web services per differenziare la risposta (ad esempio Json o XML) ● Permette di definire contesti custom ▶ Aggiungere dei suffissi alle viste ▶ Modificare l'header HTTP ▶ Definire delle callback © All rights reserved. Zend Technologies, Inc.
17.
Esempio class Application_Plugin_Mobile extends
Zend_Controller_Plugin_Abstract { public function dispatchLoopStartup( Zend_Controller_Request_Abstract $request) { $contextSwitch = Zend_Controller_Action_HelperBroker::getStaticHelper('ContextSwitch'); $contextSwitch->clearContexts() ->setContext('iphone', array( 'suffix' => 'iphone', 'headers' => array( 'Content-Type' => 'text/html;Charset=UTF-8'), )) ->setContext('html', array( 'suffix' => 'html', 'headers' => array( 'Content-Type' => 'text/html;Charset=UTF-8'), )) ->setAutoDisableLayout(false) ->setDefaultcontext('html') ->initContext(); © All rights reserved. Zend Technologies, Inc.
18.
Esempio (2)
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); $userAgent = $bootstrap->getResource('useragent'); switch($userAgent->getDevice()->getFeature('device')) { case 'iphone': $request->setParam('format','iphone'); break; default: $request->setParam('format','html'); } } } © All rights reserved. Zend Technologies, Inc.
19.
Esempio (3)
class IndexController extends Zend_Controller_Action { public function init() { $this->_helper->contextSwitch() ->addActionContext('index', 'iphone') ->initContext(); } … } index.phtml index.iphone.phtml View © All rights reserved. Zend Technologies, Inc.
20.
Zend_Mobile ●
Zend_Mobile_Push ▶ Invio di notifiche push verso specifici vendor ● APNS (iTouch/iPad/iPhone) ● C2DM (Google Android) ● MPNS (Windows Phone) © All rights reserved. Zend Technologies, Inc.
21.
Esempio $message = new
Zend_Mobile_Push_Message_Apns(); $message->setAlert('Zend Mobile Push Example'); $message->setBadge(1); $message->setSound('default'); $message->setId(time()); $message->setToken('ABCDEF0123456789'); $apns = new Zend_Mobile_Push_Apns(); $apns->setCertificate('/path/to/provisioning-certificate.pem'); // if you have a passphrase on your certificate: // $apns->setCertificatePassphrase('foobar'); ... © All rights reserved. Zend Technologies, Inc.
22.
Esempio (2) try {
$apns->connect(Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI); } catch (Zend_Mobile_Push_Exception_ServerUnavailable $e) { // you can either attempt to reconnect here or try again later exit(1); } catch (Zend_Mobile_Push_Exception $e) { echo 'APNS Connection Error:' . $e->getMessage(); exit(1); } try { $apns->send($message); } catch (Zend_Mobile_Push_Exception_InvalidToken $e) { echo $e->getMessage(); } catch (Zend_Mobile_Push_Exception $e) { echo $e->getMessage(); } $apns->close(); © All rights reserved. Zend Technologies, Inc.
23.
Domande?
© All rights reserved. Zend Technologies, Inc.
24.
Grazie! Per maggiori informazioni: http://framework.zend.com/
© All rights reserved. Zend Technologies, Inc.