All Projects → gentritabazi01 → Clean-Laravel-Api

gentritabazi01 / Clean-Laravel-Api

Licence: other
⭐️ Build APIs You Won't Hate In Laravel.

Programming Languages

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

Projects that are alternatives of or similar to Clean-Laravel-Api

docker-laravel-api-dev
🐳 The containerized Laravel API development environment
Stars: ✭ 31 (-63.53%)
Mutual labels:  laravel-api, laravel-api-boilerplate
december-2018-meetup
🤖 Build an API with Laravel 5.7
Stars: ✭ 27 (-68.24%)
Mutual labels:  laravel-api, laravel-api-boilerplate
laravel-api-auth
A Laravel Package for easy API authentication setup with passport
Stars: ✭ 29 (-65.88%)
Mutual labels:  laravel-passport, laravel-api
laravel-passport-socialite
The missing social authentication plugin (i.e. SocialGrant) for laravel passport.
Stars: ✭ 50 (-41.18%)
Mutual labels:  passport, laravel-passport
security-starter
Security starter is a full implementation of laravel/passport and heloufir/simple-passport, containing all the implementations of the authentication and forgot password systems, which allows you to start your project from a good foundation, and only worry about the business logic of your application.
Stars: ✭ 31 (-63.53%)
Mutual labels:  laravel-passport
IDVerification
"Very simple but works well" Computer Vision based ID verification solution provided by LibraX.
Stars: ✭ 44 (-48.24%)
Mutual labels:  passport
nest-auth-example
Nest.js authentication with Passport. Realworld example
Stars: ✭ 186 (+118.82%)
Mutual labels:  passport
express-4.x-twitter-example
Express 4.x app using Passport for sign in with Twitter.
Stars: ✭ 103 (+21.18%)
Mutual labels:  passport
kauth
🔑 kauth is JWT API Authentication ( jwt-auth ) for laravel
Stars: ✭ 14 (-83.53%)
Mutual labels:  laravel-api
teanjs
🔥 TypeORM - Express - Angular 8 - NestJS Server Side Rendering (SSR) 😺
Stars: ✭ 62 (-27.06%)
Mutual labels:  passport
lumen-lighthouse-graphql
Lumen example use of a GraphQL PHP server using Lighthouse package
Stars: ✭ 31 (-63.53%)
Mutual labels:  laravel-passport
express-authentication
Simple authentication app using express, node & passport.
Stars: ✭ 58 (-31.76%)
Mutual labels:  passport
jeesuite-passport
Jeesuite-passport是面向企业级单点登录、统一认证的一站式解决方案。支持微信、企业微信、主流开放平台OAuth、Oauth2.0,JWT、SAML2.0多种认证集成模式。
Stars: ✭ 108 (+27.06%)
Mutual labels:  passport
laravel-api-example
💻 Build an API with Laravel 5
Stars: ✭ 47 (-44.71%)
Mutual labels:  laravel-api
system information school
Build website using laravel as backend, vue js as front end and full request using api with middleware api passport.
Stars: ✭ 17 (-80%)
Mutual labels:  passport
passport-42
Passport strategy for authenticating with 42 using the OAuth 2.0 API
Stars: ✭ 26 (-69.41%)
Mutual labels:  passport
ng-nest-cnode
Angular 10 Front-End and Nestjs 7 framework Back-End build Fullstack CNode
Stars: ✭ 17 (-80%)
Mutual labels:  passport
yelp-camp
A Node.js web application project from the Udemy course - The Web Developer Bootcamp by Colt Steele
Stars: ✭ 36 (-57.65%)
Mutual labels:  passport
react-node-twitter-login
Demo application that shows how to enable Twitter login with React on frontend and Node.js/Express on backend
Stars: ✭ 34 (-60%)
Mutual labels:  passport
ExpressJS-SocketIO-Boilerplate
📦 Simple Express.js & Socket.io Boilerplate
Stars: ✭ 31 (-63.53%)
Mutual labels:  passport

Introduction

Clean-Laravel-Api offers you to do modern API development in Laravel. Project has also support for new versions of Laravel.

Clean-Laravel-Api comes included with...

  • Support for Laravel 7.0 and Laravel 8.0.
  • Laravel Passport for OAuth Authentication, including a proxy for password and refresh-token grants.
  • A new directory structure optimized for separating infrastructure and domain code. Groups your controllers, models, etc. by resource-type.
  • A modern exception handler for APIs.
  • A base controller class that gives sorting, filtering, eager loading and pagination for your endpoints.
  • A base repository class for requesting entities from your database.
  • A library for creating advanced structures of related entities.

...

This project is built with one2tek/larapi package

Automatic Installation

git clone https://github.com/gentritabazi01/Clean-Laravel-Api && cd Clean-Laravel-Api && sh ./scripts/install.sh

This will:

  • Create the project.
  • Install the dependencies.
  • Create the .env file in the project root.
  • Generate the APP_KEY.
  • Create a symbolic link from public/storage to storage/app/public.

Now you just need to update your .env file as needed and install passport (check below how to install passport).

Manual Installation

First clone the repository.

git clone https://github.com/gentritabazi01/Clean-Laravel-Api

Install dependencies.

composer install

Copy the .env file an create and application key.

cp .env.example .env && php artisan key:generate

Create a symbolic link from public/storage to storage/app/public.

php artisan storage:link

Migrate the tables.

php artisan migrate

Project comes with Passport include as the default authenticatin method. You should now install it using this command.

php artisan passport:install

Copy-paste the generated secrets and IDs into your .env file like so.

PERSONAL_CLIENT_ID=1
PERSONAL_CLIENT_SECRET=mR7k7ITv4f7DJqkwtfEOythkUAsy4GJ622hPkxe6
PASSWORD_CLIENT_ID=2
PASSWORD_CLIENT_SECRET=FJWQRS3PQj6atM6fz5f6AtDboo59toGplcuUYrKL

If you want to save it elsewhere or change the naming be sure to modify the LoginService in infrastructure/Auth/Services/LoginService.php

If you want to use docker to install composer dependencies use this script.

Test installation

You can quickly test if the authentication works by creating an user using the include command.

php artisan users:add {first_name} {last_name} {email} {password}
Example: php artisan users:add Gentrit Abazi [email protected] mypassword

Now serve your application and try to request a token using cURL

php artisan serve
curl -X POST http://localhost:8000/login -H 'Content-Type:application/json' -d '
{
    "email":"[email protected]",
    "password":"mypassword"
}'

This should return a token.

{"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImM0MWZiOWFjZjkyZmRiY2RhYjE0ZmEwYTFlMzMwYjBjYTEwMmRiMTA1ZGI4MmZjYzllZGUwMjRiNzI2MjA2YjRhZDU4MGZhMjUxODU2Y2RkIn0.eyJhdWQiOiIyIiwianRpIjoiYzQxZmI5YWNmOTJmZGJjZGFiMTRmYTBhMWUzMzBiMGNhMTAyZGIxMDVkYjgyZmNjOWVkZTAyNGI3MjYyMDZiNGFkNTgwZmEyNTE4NTZjZGQiLCJpYXQiOjE0ODk5NTM3MDYsIm5iZiI6MTQ4OTk1MzcwNiwiZXhwIjoxNDg5OTU0MzA2LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.SmsEyCEXBiwSgl0yMcjvCxoZ2a_7D6GDJTxTs_J-6yzUeJkOofrSV7RRafO3VvUckrNqy5sGgglrwGH_HN7_lNPU6XcgaaNzbzf-g7vCSzCicJiYZVzxqJpZVwqQ4WIQrc0lYdk7suZ7hwQulOD_Z79JhBNh1KSAyo3ABWHiRjh9NR_-iAjvlCohh7nAETDeVqoMrR99m3fwQYOjdtvRBHJ8Ei-Kx3Gn1DyOXyh8eGa5-yDtj-ZVI9x66YMXlm8wk4IMA_Oh7KJISfdpoQs4fPyrGsFAxQMFp02qEW2fzKl2eesZeiIAyDGWE4StHsuY3E4jZL0P-pjv08j5W4CBP0P64gkNw_GdbxlPPA-qZUzJlc3EtjrzZ9WZq3JAKKCGy5I1jHECDOqaQ1z7axm6rmxRWmXmRGwwkne8QxfPlXsN0sm5q98mJckeqCLUuir1VPyFn5Z-B7D80-sc7Zm-7zi-awJtZUGMcHSo_yNHXjVGcbJwFk04xoIL2QzMXpOVPLaUdlBp_obCJhdzT5Bx0o5SDdK2LwgEwbMkksqmrTJ7ypoezsc3ihVQIrMelK2lNfkH_cDcVdD3ub8oFTthbA62U6atXaIADcsgTCgOtgQ2uXTIko_btjECgL35LZDd8UxiyQT3w-pDrELGDPx17DQCsIZDJ8mC1s6E0d7EPsA","expires_in":600}

Now try to request all users GET /users using the newly issued token.

curl http://localhost:8000/users -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImM0MWZiOWFjZjkyZmRiY2RhYjE0ZmEwYTFlMzMwYjBjYTEwMmRiMTA1ZGI4MmZjYzllZGUwMjRiNzI2MjA2YjRhZDU4MGZhMjUxODU2Y2RkIn0.eyJhdWQiOiIyIiwianRpIjoiYzQxZmI5YWNmOTJmZGJjZGFiMTRmYTBhMWUzMzBiMGNhMTAyZGIxMDVkYjgyZmNjOWVkZTAyNGI3MjYyMDZiNGFkNTgwZmEyNTE4NTZjZGQiLCJpYXQiOjE0ODk5NTM3MDYsIm5iZiI6MTQ4OTk1MzcwNiwiZXhwIjoxNDg5OTU0MzA2LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.SmsEyCEXBiwSgl0yMcjvCxoZ2a_7D6GDJTxTs_J-6yzUeJkOofrSV7RRafO3VvUckrNqy5sGgglrwGH_HN7_lNPU6XcgaaNzbzf-g7vCSzCicJiYZVzxqJpZVwqQ4WIQrc0lYdk7suZ7hwQulOD_Z79JhBNh1KSAyo3ABWHiRjh9NR_-iAjvlCohh7nAETDeVqoMrR99m3fwQYOjdtvRBHJ8Ei-Kx3Gn1DyOXyh8eGa5-yDtj-ZVI9x66YMXlm8wk4IMA_Oh7KJISfdpoQs4fPyrGsFAxQMFp02qEW2fzKl2eesZeiIAyDGWE4StHsuY3E4jZL0P-pjv08j5W4CBP0P64gkNw_GdbxlPPA-qZUzJlc3EtjrzZ9WZq3JAKKCGy5I1jHECDOqaQ1z7axm6rmxRWmXmRGwwkne8QxfPlXsN0sm5q98mJckeqCLUuir1VPyFn5Z-B7D80-sc7Zm-7zi-awJtZUGMcHSo_yNHXjVGcbJwFk04xoIL2QzMXpOVPLaUdlBp_obCJhdzT5Bx0o5SDdK2LwgEwbMkksqmrTJ7ypoezsc3ihVQIrMelK2lNfkH_cDcVdD3ub8oFTthbA62U6atXaIADcsgTCgOtgQ2uXTIko_btjECgL35LZDd8UxiyQT3w-pDrELGDPx17DQCsIZDJ8mC1s6E0d7EPsA'

This should return a response like so

{"users":[{"id":1,"first_name":"Gentrit","last_name":"Abazi","email":"[email protected]","name":"Gentrit Abazi"}]}

You can refresh a new token by requesting POST /login/refresh and logout using POST /logout.

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].