Search code examples
phplaravelauthenticationhashlaravel-5.3

Can a "plain" php application use a laravel user table for authentication?


Currently I have a Laravel application with authentication. I'm wondering if I could have another PHP application (framework independent) that uses the same user table for authentication. I don't want to use Laravel again because it would be a over engineering.

My main concern is how the hashing of the password is done in Laravel. Can I configure the plain PHP application to hash passwords the same way? If so, how can I do this?


Solution

  • Laravel uses password_hash() to create a password hash (see the make() method source code):

    password_hash('somePassword555', PASSWORD_BCRYPT);
    

    And password_verify() to check password hash (see the check() method source code):

    password_verify('somePassword555', $hashedPasswordFromDB);