REST Framework for PHP API [closed]

0

I want to develop an API so that some sites can collect data from my database. Searching I have seen that there are many Frameworks for this purpose. The idea is that the API allows login and execute GET, PUT, DELETE, POST .. What is the best framework for initiating? Taking into consideration performance, security ..

    
asked by anonymous 27.07.2017 / 21:51

1 answer

5

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

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

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

If your current application is Laravel and you need to take advantage of existing rules or Models in your Laravel project, you can use 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 like this:

Verbo     | URI                  | Método  | Nome da rota
----------+----------------------+---------+--------------
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
    
27.07.2017 / 22:43