Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use built-in laravel 5.3 features or dingo to create APIs? [closed]

I'm really new in API developing but I developed many websites before using Laravel.(and PHP)

Now I want to create my first API that can respond to any kind of clients like Android , iOS or an Angular powered Application.

I've done a lot of research in this case that How can I make an API via laravel.

I found that there is a package named dingo/api that simplifies and provide requirements to create flexible APIs.

And in the other hand, in last version of Laravel (5.3) added new features that help to create APIs like Passport.

But I am confused and do not know which are best approach.

Whether the use of Laravel in this case alone is enough? or will I surely need Dingo?

like image 579
A.B.Developer Avatar asked Oct 15 '16 11:10

A.B.Developer


1 Answers

That really depends on what are you looking to achieve, if you want a versioned api rest with pagination and all the features normally an API has, then for me the best approach is to use dingo api, but if you want to provide data in JSON from a website already created, just return the entities in the actions of the controller and laravel itself will return them encoded to json, is a matter of your own choice, now, you can always use a generator like this: https://github.com/InfyOmLabs/laravel-generator to generate the whole scaffolding, and that's include a REST API with documentation too. And in the security layer, you can use an OAuth server with laravel passport, or can use JWT Auth using this package https://packagist.org/packages/tymon/jwt-auth, the configuration and usage is pretty easy. What I want to say, is a matter of choice, just that.

like image 193
bretanac93 Avatar answered Oct 30 '22 12:10

bretanac93