Home

Awesome

Starter Kit for Laravel Sanctum

An opinionated Laravel starter kit for RESTful API development with Sanctum.

Requirements

Features

To do

  1. Add front-end url in the .env file
FRONT_END_URL=http://localhost
  1. Edit the boot method in AuthServiceProvider.php file to ensure that your front-end endpoints are correct
VerifyEmail::createUrlUsing(function ($notifiable) {
    // $url is directly set as the API endpoint for email verification
    // see 'verification.verify' route
    $url = URL::temporarySignedRoute(
        'verification.verify',
        now()->addMinutes(Config::get('auth.verification.expire', 60)), [
            'id' => $notifiable->getKey(),
            'hash' => sha1($notifiable->getEmailForVerification()),
        ]
    );

    return Config::get('app.frontend_url').'/email-verification?url='.urlencode($url);
});

ResetPassword::createUrlUsing(
    fn ($user, string $token) => Config::get('app.frontend_url').'/reset-password?email=' . $user->email . '&token='.$token
);
  1. Setup your mail server

Testing

php artisan test

Documenation

Run php artisan serve and open http://127.0.0.1:8000/docs in your web browser.