background preloader

Slim

Facebook Twitter

Getting Started with Slim Framework - Creating a RESTful API · Codoki. 27 Jan 2015 Here's a quick tutorial to get up and running with Slim PHP Framework to start building RESTful applications. Why a REST API? A REST API acts like a middle-man between clients (mobile devices, computers) and the database server. This type of infrastructure allows clients using completely different technologies or operating systems to communicate in one type of protocol.

That way as technologies change, the method of communication with the database and server logic can remaind the same. Just remember, the application we are building is meant to be used with client applications and not really meant for actual users to be using it... so it's not going to look very pretty. We will be building a nice looking client application later that will be used to interact with the API--and that will look pretty. Why use Slim? Slim is a micro framework for PHP that allows you to quickly build web applications and APIs. 1. 2. Insert some sample data into the database. 3. 4. 5. 6. 7. 8. 9. 10. Building a Basic CRUD Application Using AngularJS and Slim PHP framework (Part 1) | iamaronbarbosa:~$ I’ve been starting to learn and use AngularJS on some of my projects lately so I decided to share what I’ve learned so far. AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running single-page applications.

Its goal is to augment browser-based applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier.According to Wikipedia Today we’re going to create a basic CRUD application using AngularJS and the Slim PHP Framework. Slim a PHP micro framework that helps you create powerful web applications and APIs. Let’s start by creating a new database name `angular_crud` then run the following SQL: I’ve added sample data in the sql file so it would be easier. Download the files for the part 1 of the tutorial here then I’ll walk you through the code. First let’s take a look at the index.html: Take note of the two directives in the index.html file. Now let’s check out our angular app. Viola! Create RESTful API / Web Service with Slim, PHP and MySQL.

I have received many requests from readers and after lots of searching I found out a light weight frame work to create Restful API in PHP. There are a number of frame works available and the one I chose is SLIM (it is a micro framework that helps you efficiently write powerful web services). This tutorial gives you complete examples of creating full Restful API using multiple HTTP methods like GET, POST, PUT and DELETE. You would get the output in JSON and create a user data for all options, download code available. HTTP methods: GET: Used to retrieve and search data. POST: Used to insert data. PUT: Used to update data. DELETE: Used to delete data. Add below .htaccess file in your api folder RewriteEngine On RewriteBase /api # if hosting api files on root use only / RewriteCond %{REQUEST_FILENAME} ! Database configuration Edit database name, user and password as per your configuration Implement API We have created 6 API methods Define HTTP routes: let’s see functions:

Getting Started with Slim Framework - Creating a RESTful API · Chris Diana. 27 Jan 2015 Here's a quick tutorial to get up and running with Slim PHP Framework to start building RESTful applications. Why a REST API? A REST API acts like a middle-man between clients (mobile devices, computers) and the database server. This type of infrastructure allows clients using completely different technologies or operating systems to communicate in one type of protocol. Why use Slim? Slim is a micro framework for PHP that allows you to quickly build web applications and APIs. 1. You can start by downloading it here and extract the Slim framework into your project directory. 2. Login into MySQL and create a new database to have our Slim application interact with. CREATE DATABASE garage; USE garage; CREATE TABLE cars ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, year INT(4) NOT NULL, make VARCHAR(30) NOT NULL, model VARCHAR(40) NOT NULL ); Insert some sample data into the database. 3.

We are also going to use a plugin called NotORM that will make working with the database easier. Add A Splash Screen To An IonicFramework Project. It is always nice to have splash screens in your application. It is a great way to get your branding out, and show that your application is currently loading. No one likes to see a blank white screen for five seconds during launch. Lucky for us, it is incredibly simple to add a splash screen to our Ionic project. Using Apache Cordova’s Splashscreen plugin, we can add a splash to our application with just two lines in our config.xml file. If you haven’t already, add the iOS and Android platforms to your IonicFramework project: Add iOS and Android platforms To take advantage of Apache Cordova’s splash screen plugin, add it to your project by running: Apache Cordova Splash Screen Now this is where the Cordova documentation gets a little sketchy.

Instead you must change value=”splash” with value=”screen”. You can find the splash screen images in the platforms/android/res and platforms/ios/{project_name}/Resources/splash directories. Recommended splash screen sizes are as follows: