Giter Club home page Giter Club logo

who-are-you's Introduction

Build

who-are-you

Laravel api authentication package

Instalation

Step one

Install the package, run the migration, initialize the passport

composer require azibom/who-are-you
php artisan migrate
php artisan passport:install

Step two

  1. Add the HasApiTokens trait to the user model
<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;
class User extends Authenticatable
{
    use Notifiable, HasApiTokens;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}
  1. Change the api guard in the config/auth.php
...
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
    ],
...
  1. Add the WHO_ARE_YOU_BASE_URL env var in the .env file of the project
WHO_ARE_YOU_BASE_URL=http://localhost

(If you are using docker for example you should change it with your webserver container's name for example)

WHO_ARE_YOU_BASE_URL=http://nginx

Todos

□ complete the doc (add the document for the routes and how to use it)

□ add the push to the vendor for the controller and repositoy directories

□ try to handle the above changes automaticly in the package (change the .env or auth.config filr)

□ just send the data of the request to the repositoty not the whole of the request

□ add the test to the project

□ add the phpcs to the project

□ add the ci/cd pipline to the project

who-are-you's People

Contributors

azibom avatar revisto avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

revisto

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.