Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AndrewBen's avatar

How to use the Laravel Users table on a Php project.

Hello, I want to connect two projects to the same MySql table. The main site uses Laravel and the other uses plain PHP script built from scratch. I want users to be able to login to the table using their data on the Users table from Laravel but am having password issues.

Laravel uses a hash encrypt for his password and I can't find a way to unhash it during login for the plain PHP site.

Below is the PHP code I wrote for the login but is not working.

  $email= filter_input(INPUT_GET, 'email', FILTER_SANITIZE_STRING);

 $password = filter_input(INPUT_GET, 'password', FILTER_SANITIZE_STRING);

Any help would be appreciated.

0 likes
1 reply
Sergiu17's avatar

vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php take a look in this class

$hash = password_hash($value, PASSWORD_BCRYPT, [
'cost' => $this->cost($options),
]);

this is the algorithm which is used by laravel, make sure before you log in with your plain PHP app, you hash the password in the same way

1 like

Please or to participate in this conversation.