Article: Mobile App Development with Zend Studio

An excerpt from, by Daniel Berman

The world has turned mobile. This is not new, and it should therefore be no surprise to anyone that the results of the 2015 DevPulse survey by Zend show that a vast majority of PHP developers are working on, or intend to work on, mobile apps.

Mobile app development poses many challenges for developers, one of which is tying in the front end of the mobile application with the back-end web service APIs.

This tutorial describes how to simultaneously create, test and modify both the front and back end of a modern mobile app using Zend Studio’s mobile development features.

The steps described in this article were performed using Zend Studio 12.5 and a Zend Server 8 AWS instance. You can, of course, use any PHP server of your choice, local or remote, to host the API project.

Step 1: Creating a Cloud Connected Mobile Project

Your first step is to create a new Cloud Connected Mobile (CCM) project in your Zend Studio workspace.
A CCM project contains both a hybrid mobile project defining the front-end of your mobile app and a project containing all the back-end APIs.

  1. In Zend Studio’s menu-bar, go to File | New | Cloud Connected Mobile project.

2. In the New Cloud Connected Mobile Project wizard, enter a name for both the mobile client side project and the server-side project.

  1. In the PHP Server drop-down menu, select a PHP server, and then click Next.

4. In the next step of the wizard, you can select from one of the available project templates. Each contains a different code package with implementation examples. Read the descriptions for more info.
In this tutorial, we’re going to go for the Simple Services template, which contains an example implementation of a REST service, and a client – side project consuming this service.

  1. Click Finish.

Two new projects appear in your workspace in the PHP Explorer.

Step 2: Previewing your App

Our next step is to preview our mobile app using the CordovaSim emulator supplied with Zend Studio. Obviously, since we just created the project, we will be previewing the sample code supplied with the template.

The CordovaSim mobile application simulator is a lightweight and fast emulator that allows you to preview your mobile application during and after development. It’s also an easy way to emulate native events (like for the accelerometer, geolocation, networking, etc.) using a GUI panel, which is important for mobile app testing.

To preview our mobile app, we will first need to deploy our server-side project containing the services it consumes.

  1. In the PHP Explorer, open the server-side project’s deployment.xml file. Tip: If there is no such file, simply right-click the server-side project, and select Configure | Add Application Deployment Support.

2. In the Testing area, click Deploy application.

3. In the Deploy PHP Application dialog that pops up, select the server you wish to deploy to.

  1. Verify the application URL, and click Finish.
    The server-side project is deployed to the selected server.

  2. Right-click the project in the PHP Explorer, and select Run As | Run with CordovaSim.
    Your mobile application is opened in the CordovaSim emulator.

As you can see, the mobile app supplied with the template we chose for our CCM project is a very basic app that displays a list of customers with a button that retrieves the list. We will be developing this app later on in this tutorial.

Continue reading this article on SitePoint!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.