Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create a REST API in PHP? [closed]

Tags:

php

api

I've been developing gaming site and planning to add an API to let developers create games for the site. The only problem is how do you create an API more specifically a REST API in PHP or any other language that could develop APIs?

Sorry, just new in API Development.

Any help is appreciated.

like image 335
Sean Francis N. Ballais Avatar asked May 16 '12 12:05

Sean Francis N. Ballais


People also ask

Can you create REST API in PHP?

Steps to create REST API:Create a database and DB table. Establish database connection. Create a REST API file. Create index or HTML file.

Is PHP GOOD FOR REST API?

There are many PHP Frameworks that can be used to create REST APIs. Besides what I've mentioned above, there are several other popular PHP frameworks. Laravel, Symfony, CodeIgniter, Yii, CakePHP, and others can all create REST APIs. Depending on your needs, anyone of those frameworks may be best for you.

What is REST API in PHP?

Rest API is an API that allows programmers to send and receive information from other programs using HTTP protocol commands such as GET and POST. Although REST API works with most protocols, it is specially designed for transmitting data through the HTTP protocol.

How do I create a REST API session?

You may create a new session using either the user's ID or the username by specifying id or username in the user JSON object in the request body. Creating a new session will send a push notification to the user's device informing them of a pending authentication request.


1 Answers

It's pretty easy when you understand the fundamentals. Basically you want controllers mapped to actions that modify data, whether that data's in a database, XML file, CSV file, text file depends on your models.

I created a simple API framework starter that you can take a look at and get started with: https://github.com/martinbean/api-framework

like image 167
Martin Bean Avatar answered Oct 10 '22 23:10

Martin Bean