How To Build Web Application CRUD with Codeigniter 3.1.0

How to Build Web Application Signup with Codeigniter 3.1.0

This tutorial is about How to Build Web Application Signup with Codeigniter 3.1.0

Introduction

This tutorial is to guide developers creating simple Mesosfer Web Application for user sign up with Codeigniter 3.1.0 based on mesosfer docs.

Prerequisites

To follow this tutorial, you will need to prepare these items below :

  • Sign up for an account in mesosfer cloud platform then create application to get applicationId.
  • Install composer.
  • Download source framework codeigniter version 3.1.0 from this site.

Getting Started

To get our web application working well, you will need to have an applicationId from Mesosfer cloud platform. Login and go to Apps –> then click App Setting like the picture below.

Perpare & Setup Environment

Download source framework from codeigniter site then deploy to your web server (apache2, nginx, or others). Edit file application/config/autoload.php and change configuration like code below :

Update $config[composer] on file application/config/config.php

Add Guzzle Package

Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services. Install on your codeigniter using composer like command below :

Prepare your own code

You have to create controller first.  For example User.php on application/controller, then fill code below :

Add static variable for appId, appKey, and instance of guzzle object. Then define new instance guzzle on construct class. Don’t forget to fill appId based on your applicationId in mesosfer cloud platform.

First, we make method login as navigation to register view page.

Then create directory pages in application/views and add file register.php on that directory. There is gonna be like this “application/views/pages/register.php”. Create form register inside that file.

If you access it from browser, It will be like the picture below:

How to Build Web Application Signup with Codeigniter 3.1.0

Then let’s create signup method that handle action from register.

If you want to display response result from Mesosfer RestAPI, we can var_dump variable $auth like script below :

Result of json response :

If you look at your user data in Mesosfer cloud platform, It will look like the picture below :

How to Build Web Application Signup with Codeigniter 3.1.0

Let’s try and share to your community. Download complete code here.

Conclusion

In this tutorial we’ve tried to create simple module signup user with Mesosfer and codeigniter. By using Mesosfer you will reduce your development process. Mesosfer also provide some other platform of SDK such as mobile application, game, and others so you can transfer your data in another platform easily. Mesosfer helps you connect your project to the cloud. Cut off the development process so you can straight into the delivery process instead stumble on the complicated infrastructure.

Mesosfer Technology Evangelist and Technopreneur focus on Internet of Things (IoT)

Leave a Reply