2017 © Pedro Peláez
 

library laravel-auth-file

File-based auth driver

image

gponster/laravel-auth-file

File-based auth driver

  • Wednesday, January 14, 2015
  • by gponster
  • Repository
  • 1 Watchers
  • 2 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel File-Based DB Auth

  • Laravel: 4.2
  • Author: Gponster

This package is not a replacement for laravels default Auth library, it's a simple auth driver using configuration file-based DB for username/password., (*1)

Installation

Firstly you want to include this package in your composer.json file., (*2)

"require": {
        "gponster/laravel-auth-file": "dev-master"
}

Now you'll want to update or install via composer., (*3)

composer update

Next you open up app/config/app.php and replace the AuthServiceProvider with, (*4)

'Gonster\Auth\File\AuthServiceProvider',

NOTE It is very important that you replace the default service providers. If you do not wish to use Reminders, then remove the original Reminder server provider as it will cause errors., (*5)

Configuration is pretty easy too, take app/config/auth.php with its default values:, (*6)

return array(

    'driver' => 'eloquent',

    'model' => 'User',

    'table' => 'users',

    'reminder' => array(

        'email' => 'emails.auth.reminder',

        'table' => 'password_reminders',

        'expire' => 60,

    ),

);

and replace the auth driver to 'file', (*7)

'driver' => 'file',
'model' => 'AuthUser',
'username' => 'email',
'password' => 'password',

The simple AuthUser class, (*8)

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Illuminate\Auth\GenericUser;

class AuthUser extends GenericUser implements UserInterface, RemindableInterface {

    public static $rules = array(
       'email'=>'required|email',
       'password'=>'required|alpha_num|between:6,12|confirmed',
   ); 

    /**
     * Dynamically access the user's attributes.
     *
     * @param  string  $key
     * @return mixed
     */
    public function getAttribute($key)
    {
        return $this->__get($key);
    }

    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->attributes['email'];
    }

    /**
     * Get the password for the user, needs to return the hashed password
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->attributes['password'];
    }

    /**
     * Get the e-mail address where password reminders are sent.
     *
     * @return string
     */
    public function getReminderEmail()
    {
        return $this->attributes['email'];
    }
}

The Versions

14/01 2015

dev-master

9999999-dev

File-based auth driver

  Sources   Download

MIT

The Requires

 

by Avatar gponster

laravel auth

14/01 2015

v1.0

1.0.0.0

File-based auth driver

  Sources   Download

MIT

The Requires

 

by Avatar gponster

laravel auth