All Projects → pktharindu → laravel-api-boilerplate-passport

pktharindu / laravel-api-boilerplate-passport

Licence: MIT license
An API Boilerplate to create a ready-to-use REST API in seconds.

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects
shell
77523 projects

Projects that are alternatives of or similar to laravel-api-boilerplate-passport

ID-Card-Passport-Recognition-SDK-Android
On-Device ID Card & Passport & Driver License Recognition SDK for Android
Stars: ✭ 223 (+1015%)
Mutual labels:  passport
express-mongo-jwt-boilerplate
Express Mongo JsonWebToken boilerplate
Stars: ✭ 100 (+400%)
Mutual labels:  passport
terraform-aws-api-gateway-enable-cors
Easily add an OPTIONS method to an API Gateway resource to enable CORS
Stars: ✭ 56 (+180%)
Mutual labels:  cors
CORS-Proxy-Server
代理转发 CORS 跨域资源请求
Stars: ✭ 13 (-35%)
Mutual labels:  cors
auth-quickstart
Authentication Quickstart with Express, Passport and Sequelize
Stars: ✭ 49 (+145%)
Mutual labels:  passport
express-mvp
Express.js project template ready to go
Stars: ✭ 21 (+5%)
Mutual labels:  passport
seedpress-cms
A headless CMS built in Express for PostgresQL using Sequelize. Generally follows the Wordpress post and term schema.
Stars: ✭ 71 (+255%)
Mutual labels:  passport
laravel-vue-starter
Well Documented Laravel Starter App From Development to Production. For Full Blown RESTFUL API and SPA with Beautiful UI Using Buefy / ElementUi For Reusable Vue Components
Stars: ✭ 80 (+300%)
Mutual labels:  dingo
passport-local-knex
adding passport to a node app
Stars: ✭ 51 (+155%)
Mutual labels:  passport
discord-dashboard
Example of Discord Oauth2 - Complete with Discord Bot
Stars: ✭ 35 (+75%)
Mutual labels:  passport
aws-lambda-router
Improved routing for AWS Lambda like SNS and ApiGateway
Stars: ✭ 90 (+350%)
Mutual labels:  cors
passport-local-sequelize
passport-local-sequelize is a sequelize plugin for building username and password login with passport
Stars: ✭ 81 (+305%)
Mutual labels:  passport
Natours
An awesome tour booking web app written in NodeJS, Express, MongoDB 🗽
Stars: ✭ 94 (+370%)
Mutual labels:  cors
mezzio-cors
CORS component for Mezzio and other PSR-15 middleware runners.
Stars: ✭ 13 (-35%)
Mutual labels:  cors
todos-express-password
Todo app using Express and Passport for sign in with username and password.
Stars: ✭ 739 (+3595%)
Mutual labels:  passport
add-my-name
No more WhatsApp spams 🎉
Stars: ✭ 16 (-20%)
Mutual labels:  passport
sanic-ext
Extended Sanic functionality
Stars: ✭ 26 (+30%)
Mutual labels:  cors
gotify-push
Chrome Extension for Send Push Notification 🔔 to gotify/server ☁
Stars: ✭ 32 (+60%)
Mutual labels:  cors
keycloak-spring-boot-rest-angular-demo
Demo for configuring Keycloak authentication for a spring-boot rest service and AngularJs web client
Stars: ✭ 24 (+20%)
Mutual labels:  cors
apollobank
A full stack GraphQL banking application using React, Node & TypeScript.
Stars: ✭ 203 (+915%)
Mutual labels:  cors

Laravel API Boilerplate (Passport Edition)

StyleCI Scrutinizer Code Quality Build Status

Laravel API Boilerplate is a "starter kit" you can use to build your first API in seconds. As you can easily imagine, it is built on top of the awesome Laravel Framework. This version is built on Laravel 5.8!

This Boilerplate supports OAuth2 password grant out of the box which allows your other first-party clients, such as a mobile application, to obtain an access token using an e-mail address and password. But feel free to use other grant types in laravel/passport by extending this.

It is built on top of these big guys:

What I made is really simple: an integration of these three packages and a setup of some authentication and credentials recovery methods.

Installation

  1. run composer create-project pktharindu/laravel-api-boilerplate-passport newProject;
  2. have a coffee, nothing to do here;

Once the project creation procedure will be completed, run the php artisan migrate command to install the required tables.

Then, run the php artisan passport:client --password command to create a password grant client to issue access tokens securely to your first-party clients.

Main Features

Ready-To-Use Authentication Controllers

You don't have to worry about authentication and password recovery anymore. I created four controllers you can find in the App\Api\V1\Controllers for those operations.

For each controller there's an already setup route in routes/api.php file:

  • POST api/auth/login, to do the login and get your access token or to refresh your existent token;
  • POST api/auth/register, to create a new user into your application;
  • POST api/auth/recovery, to recover your credentials;
  • POST api/auth/reset, to reset your password after the recovery;
  • POST api/auth/logout, to log out the user by invalidating the passed token;

Separate File for Routes

All the API routes can be found in the routes/api.php file. This also follow the Laravel convention.

Secrets Generation

Every time you create a new project starting from this repository, the php artisan passport:keys command will be executed.

Configuration

As I already said before, this boilerplate is based on laravel/passport and dingo/api packages. So, you can find many information about configuration here and here.

There are also the validation rules for every action (login, sign up, recovery and reset) inside app/Api/V1/Requests directory. Feel free to customize them for your needs.

Creating Endpoints

You can create endpoints in the same way you could to with using the single dingo/api package. You can read its documentation for details. After all, this is just a boilerplate! 😏

However, I added some example routes to the routes/api.php file to give you immediately an idea.

Cross Origin Resource Sharing

If you want to enable CORS for a specific route or routes group, you just have to use the cors middleware on them.

Thanks to the barryvdh/laravel-cors package, you can handle CORS easily. Just check the docs at this page for more info.

Code styling

PHP-CS-Fixer is used for strong 💪 style guidelines.

PHP is pre-configured for official Laravel styling, just launch vendor\bin\php-cs-fixer fix for global project auto-formatting.

Tests

If you want to contribute to this project, feel free to do it and open a PR. However, make sure you have tests for what you implement.

In order to run tests:

  • run vendor\bin\phpunit;

Feedback

I made this project for personal purposes. I decided to share it here to help anyone with the same needs 😇. If you have any feedback to improve it, feel free to make a suggestion, or open a PR!

License

This project is open-sourced software licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].