As we all know, the app industry is booming by
leaps and bounds. And who doesn’t love to have an app? I just love Android apps
and always keep a tab on every new Android market that hits the Android app
market – the Google Play Store. Applications are a great medium that ensures
infotainment, entertainment and lets you stay organized. 

SEE ALSO: The 6 Easiest Steps To Make Your Application Portable

How to Construct an Application for App Engine in PHP
Image Credit: webdigi
What’s more? Today, it looks as if the most
talked about topic among clients is mobile apps. Why? This is because mobile
applications sales are escalating worldwide and for business owners or
individuals looking to have a great online presence finds apps to be a great
medium for reaching to millions of app users. Now, one of the common questions
that tops every business’ or individuals’ list is – “Should we hire a mobile
application developer or build a mobile application on our own instead?”

It often comes to my mind to create an app on my
own rather than splurging money in hiring some development firm. And I believe
that there are a few other people who’ll love to build an app themselves.

If you’re thinking of building applications for
Google App Engine, then you need to know that there are several languages in
which those applications can be written such as PHP, Python and Java to name a
few. In this guest post I’ll be covering how to create an application in PHP
for Google app engine.

PHP Application for Google App
Engine
Creating an application for App Engine is very
simple, and hardly takes few minutes. What’s the best part? Well, creating an
application for Google App Engine is free. Once you’ll complete building your
app, you can upload it and share it with your targeted audience without ado, at
free of cost and without the need of making any commitments.

Let’s have a look at the steps to creating Google
App Engine application using PHP:

  1. Installing
    the PHP SDK
Let’s get started! In order to develop Google App
Engine PHP applications, the first and foremost step requires you to install
and set up the app engine SDK (software development kit) and its associated
components. The app engine PHP SDK allows you to develop and later upload the
PHP applications that you’ve created.

What Else? The software development kit comprises
of a web server that you can run on your PC in order to test your PHP apps.
Once you’re done testing on your local server, the SDK lets you upload your
application to the Google App Engine with helps of its integrated software.

NOTE – Your SDK installations can vary for every
platform. Thus, it is recommended that you must follow the instructions to
install your SDK for the several platforms like Linux, MAC OS X and Windows.

  1. Developing
    and Testing your App Engine PHP applications
After installing the PHP SDK, the next step
requires you to set up a local development environment that allows you to
develop and test your PHP applications prior to displaying them to the world.
Let’s start by developing a little application
that displays a short message.

  • Creating a Simple Script
To create a simple script first you need to
create a directory let’s say the directory is called hiworld. Now, all files of
your application will be inherent in the hiworld directory. Further, inside
this directory, create a file say hiworld.php, and later give it the following
contents:

<?php

  echo ‘Hello, World!’;

This simple PHP script will respond to all the
requests with the message Hi, world!.

  • Creating the Configuration File
Once you’ve have implemented your PHP script, the
next step is to create a configuration file. The Google App Engine application
has a default configuration file known as app.yaml. This file illustrates which
scripts must be used for which URLs.

Inside the hiworld directory, create a file named
app.yaml including the following contents:

application: hiworld
version: 1
runtime: php
api_version: 1

handlers:
– url: /.*
script: hiworld.php

The aforementioned configuration file says the
following about this application:
Ø  Each and every new PHP application created on the
Google App Engine holds a unique application identifier. For instance, in the
above configuration file the application identifier is hiworld. The identifier
needs to be chosen for your PHP application as soon as you register it in the
subsequent step. Till then you can simply leave the value set to hiworld since
this value is not important when developing an application locally.
Ø  The application code that you’ve written as shown
above is version number 1. In case you alter this version prior to uploading
new versions of your application, App Engine will hold on to previous versions,
and will make you roll back to a preceding version by making use of the
administrative console.
Ø  The above application code will run in the PHP
runtime environment, namely version “1”. Few other runtime
environments and languages can also be supported at some point, in future.
Ø  All the requests to a URL whose path matches with
the regular expression ‘/.*’, must be taken care of by the hiworld.php script.

  • Testing the Application
Now you have implemented a handler script and created
a configuration file, and after mapping every URL to the handler script, your
application is complete. Last step requires you to test your application with
the web server that comes incorporated with the App Engine SDK.
Let’s begin the web server by writing the
following command, and then provide it the path to the hiworld directory:

google_appengine/dev_appserver.py hiworld/

Now, your web server is running, and listening
for requests, for example, on port 8080. In order to test your application, you
need to visit the following URL in your browser:
http://localhost:8080/
Now you have built yourself a complete App Engine
PHP application, why not share it with the world!

A Final Thought!
If you want to build a PHP app for the Google App
Engine, you must consider the above mentioned steps that can be your definitive
guide to building an excellent PHP application. However, even though it might
seems easy to you to build an application by following the above mentioned
steps, but I’ll advice that you still must talk to some app developers and app
development companies with good app development experience; preferably, you’ll
take help if you want to develop a useful and meaningful application.

SEE ALSO: Evolution of Technology in Software Application

Also, another important aspect that you must
consider is that you must be aware of what you want and if you don’t want your
data to be lost then it is important to back it up. Keeping track of these
certain points will surely help you tackle uncalled circumstances.

Maria is a qualified PHP Outsourcing Company professional who is great at delivering focus in her writings. She
works for the software giant, Xicom Technologies. Hire
PHP Programmers from Xicom to get
quality service at your fingertips.
 Maria
About the Author:

Maria is a qualified PHP Outsourcing Company professional who is great at delivering focus in her writings. She works for the software giant, Xicom Technologies. Hire PHP Programmers from Xicom to get quality service at your fingertips.