PHP code example of stellarsecurity / user-laravel

1. Go to this page and download the library: Download stellarsecurity/user-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stellarsecurity / user-laravel example snippets


use StellarSecurity\UserApiLaravel\UserApiClient;

class RegisterController
{
    public function store(UserApiClient $users)
    {
        $response = $users->create([
            'email' => '[email protected]',
            'password' => 'secret',
        ]);

        if ($response->failed()) {
            // handle error
        }

        return $response->json();
    }
}

use StellarSecurity\UserApiLaravel\Facades\StellarUser;

// Create user
$res = StellarUser::create([
    'email' => '[email protected]',
    'password' => 'secret',
]);

// Login
$auth = StellarUser::auth([
    'email' => '[email protected]',
    'password' => 'secret',
]);

// Send reset password link
StellarUser::sendResetPasswordLink('[email protected]', 'CONFIRM-CODE-123');

// Verify reset code + set new password
StellarUser::verifyResetPasswordConfirmationCode(
    '[email protected]',
    'CONFIRM-CODE-123',
    'new-password-here',
);

// Fetch profile by ID
$profile = StellarUser::user('123')->json();
bash
php artisan vendor:publish --provider="StellarSecurity\UserApiLaravel\StellarUserServiceProvider" --tag=config