REST framework for PHP API

Asked

Viewed 2,101 times

0

I want to develop an API so that some websites can collect data from my database. Searching I saw that there are many Frameworks for this purpose. The idea is that the API allows login and execute the GET, PUT, DELETE, POST methods.. What is the best Framework to start? Taking into account performance, security..

  • 1

    In this case the best will be the one you know how to use. If you do not know any, see the one you like best and study it. Without having defined metrics, defining the best is merely a matter of personal opinion, and for this reason I voted to close the question as based on opinion.

  • To create API Rest in PHP I recommend using LUMEN. It is very simple and the documentation is very good https://lumen.laravel.com/

  • This is the idea of the question. Documentation is important, it is no use to indicate me a Framework that does not find documentation.. Thanks!!

1 answer

6


Understanding the basics of what is REST and HTTP almost any framework of route control can easily create a REST application, I recommend you read:

I recommend you understand the basics of HTTP as well, as this is the basics of REST:

It is not possible to indicate the best framework, but for PHP, almost any framework that works with routes will easily serve for REST, list of frameworks and micro-frameworks:

If your current application is Laravel and you need to take advantage of the existing rules or Models in your Laravel project, you can use the Resource controllers, for example:

Route::resource('photos', 'PhotoController');

The PhotoController is your class and photos is the "prefix" of the route, which can be accessed:

Verb URI Method Route name
GET /photos index photos.index
GET /photos/create create photos.create
POST /photos store photos.store
GET /photos/{photo} show photos.show
GET /photos/{photo}/edit edit photos.edit
PUT/PATCH /photos/{photo} update photos.update
DELETE /photos/{photo} destroy photos.destroy

Browser other questions tagged

You are not signed in. Login or sign up in order to post.