DEV Community

loading...
Cover image for Laravel API Starter Kit

Laravel API Starter Kit

joselfonseca profile image Jose Luis Fonseca Updated on ・1 min read

I’ve been building API’s for the last 2 years, I always start in the same place, installing Laravel, the oAuth 2 server and the authentication without mentioning the tests for the auth endpoints.

Having this in mind, I don’t want to do that over and over again every time I start a new API and that is why I created the starter kit.

https://github.com/joselfonseca/laravel-api

This project is nothing more than the boring boilerplate I just mentioned, it is build on top of laravel and it provides the following packages already installed and configured:

Passport
Spatie Permissions
Laravel Fractal

Having all this already set up saves some time and it provides the tools to start working on the specifics for the API. It adopts oAuth 2 as the authentication provider, it has tests for the authentication endpoints as well as an exception handler.

Once you install the started kit, you can star developing the API however you want, adding the packages you like and keeping control over your codebase.

Thanks to every person that decides to give this a try and maybe collaborate to make it better.

Discussion (5)

pic
Editor guide
Collapse
kp profile image
KP

@joselfonseca Thanks for this. As you know there are lots of options available these days.

The Dingo documentation mentions we should use github.com/specialtactics/laravel5...
Also, there are GUIs like quickadminpanel available. How is this package different / better than those other options?

Collapse
joselfonseca profile image
Jose Luis Fonseca Author

Hey there!, So I don't really thing is better or worse than any other starter kit, Our team leverage this every time we start a new project that needs API. I created this since Laravel 5.1 and has been around since then, i've tried to keep it up to date with laravel and dingo releases although I still have to check if we have the latest dingo as we haven't use it this year as we moved to GraphQL with LightHouse PHP.

If dingo has a recommendation that is great, I think you should consider what is best in your use case and project's needs, many times one scaffold can be very good and other it can get on your way.

This is just another starter kit amongst many others and yes there may be other solutions that may be more completed as they may have Admin panels and stuff like that. I don't think this is better or worse, is just another option. I encourage you to choose what is best for your use case and what makes you more productive or what solves your use cases better, some times even a starter kit is not the answer, some times you just need the Laravel scaffold and that is it. I just shared this as maybe other people may find a good use case for it or not.

So what we do right now is that we use this when we need just an API for a service, and some times we put Laravel Nova on top of it if we need Admin panel. Other times we use a simple laravel Scaffold with GraphQL using Lighthouse PHP with Nova and some times just the Laravel installation.

Thanks for you comment!

Collapse
kp profile image
KP

@joselfonseca thanks for the reply..makes sense. In your experience with APIs, what is the benefit of lighthouse PHP and specifically GraphQL? Is this combination primarily optimized for data that has a "graph" (any node can connect with any other node)? Thanks...

Thread Thread
joselfonseca profile image
Jose Luis Fonseca Author

Well, maybe not as a "graph" per se but is easier from the client to request specific data, like only the fields they need and also in a single call they can batch many queries into one HTTP request (Although this is also possible with HTTP 2) but what we like the most about LightHouse PHP is that is gives us a lot out of the box, like we can have mutations and queries for an Eloquent Model just writing the type in the schema and that saves us a lot of time, Also GraphQL subscriptions helps us a lot in real time situations and the combination if Lighthouse PHP and Apollo in the clients is very nice. Gives us power + good velocity. so combine all that and add a Nova admin panel you got yourself a very productive and high velocity development XD.

Thread Thread
kp profile image
KP

Sounds amazing. I'd love to read an article on this if you find the time to write it..specifically on these productivity improvements (mutations, eloquent queries) and GraphQL subscriptions.