Mobile App Development in

barbarousmonthMobile - Wireless

Dec 10, 2013 (3 years and 10 months ago)

114 views

© All rights reserved. Zend Technologies, Inc.

Mobile App Development in
Zend Studio
10

Natalia Bartol

natalia.b@zend.com

@nataliabartol


© All rights reserved. Zend Technologies, Inc.

Cloud Connected Mobile

2

Insert
-
>Header & Footer

Configured API URL:

http://natalia.my.phpcloud.com/my_app

© All rights reserved. Zend Technologies, Inc.

Cloud Connected Mobile


creating app

3

Insert
-
>Header & Footer

1.
Create, manage, test and publish PHP Web Services to the cloud

based
on
ZF2/Zend Server Gateway

2.
Create
Phonegap

Mobile application

1.
Create
Web Mobile
user interface (unified, platform
-
agnostic)

HTML5 +
JavaScript (jQueryMobile)

2.
Bind Web Mobile UI
widgets with
PHP Web Services

3.
Test Web Mobile project using Web Mobile Emulator

4.
Generate
mobile project for specific platform (
iOS
, Android, Windows Phone)






3.
Build and test (using platform
-
specific emulators) app
-
ready mobile package files

-
Android (Zend Studio + ADT)

-
iOS

(Zend Studio +
xCode
)

-
MS phone
(Zend Studio + Visual
Studio)

Zend Studio

native
environments

© All rights reserved. Zend Technologies, Inc.

PhoneGap


PhoneGap

is a

mobile development framework

that
enables

building

applications

for mobile devices
using

JavaScript,

HTML
5

and

CSS
3
, instead of device
-
specific
languages such as

Objective
-
C
.

The resulting applications
are

hybrid
, meaning that they are neither truly native
(because all layout rendering is done via web views instead of
the platform's native UI framework) nor purely web
-
based
(because they are not just web apps, but are packaged as
apps for distribution and have access to native device

APIs).

4

© All rights reserved. Zend Technologies, Inc.

Zend Server Gateway


lightweight Zend Framework 2 module, that
helps
developers to create and manage
RPC (Remote Procedure
Call) and RESTful APIs


Uses Zend
Framework 2.1.0 components
to provide:



Routing



Easy
access to
url
/query/request body parameters



Automatic
parameters binding for
url
(path) parameters



Authentication
(HTTP Basic/Digest and Token)



Validation
&
Filtering



Convenient
automated rendering of JSON response type



XML
-

or procedural
-
style configuration


5

© All rights reserved. Zend Technologies, Inc.

Request
-
Response cycle

6

Mobile Development & Debugging

.
htaccess

Employee

Service

.php

<script type="text/javascript">

jQuery(document).ready(function() {

jQuery.ajax({

url :
"
http://natalia.my.phpcloud.com/my_app/users
",

type : "GET",

success : function(data, status, xhr) {…});

</script>

DB

Zend
Server Gateway

Routing: url
-
> php callable

Authentication, Validation, Filtering, …

index
.php

© All rights reserved. Zend Technologies, Inc.

Zend Server Gateway


REST =

Re
presentational

S
tate

T
ransfer. RESTful
applications
use HTTP
requests to
post data (create and/or update),
read
data (e.g., make queries
),
and
delete data. REST
uses HTTP
for all four CRUD (Create/Read/Update/Delete) operations.


HTTP GET: read


HTTP POST: create


HTTP PUT: update


HTTP DELETE: delete

7

© All rights reserved. Zend Technologies, Inc.

Using Zend Gateway


Configuring Zend Gateway = specifying how HTTP requests
should be handled:


Routing = mapping URL <
-
>PHP code


Authentication = can the Request be handled?


Validation & Filtering of Request parameters


Rendering JSON Response

8

© All rights reserved. Zend Technologies, Inc.

Zend Gateway: Routing


GET
http://
natalia.my.phpcloud.com/s/users


Company
\
Services
\
Users::
getAll


POST
http://
natalia.my.phpcloud.com/s/users


Company
\
Services
\
Users::
addUser


DELETE
http://
natalia.my.phpcloud.com/s/users

Company
\
Services
\
Users::
removeUser


GET
http://
natalia.my.phpcloud.com/s/orders

Company
\
Services
\
Orders::
getAll



9

Callable
may be defined as:


global function name


public method name in the form of
ClassName
::
methodName



closure (anonymous function; only procedural definition supported)