Skip to content

corbado/example-passkeys-php-laravel

Repository files navigation

Passkey-First Authentication Example for PHP Laravel

This is a sample implementation of a PHP Laravel application that offers passkey authentication. For simple passkey-first authentication, the Corbado web component is used.

Please read the full blog post to understand all the required steps for a passkey integration into PHP Laravel apps.

File structure

...
├── .env                              # Contains all environment variables
├── app
|   ├── Http                        
|   |   ├── Kernel.php                # Controls the middleware
|   |   └── Controllers
|   |       └── Controller.php        # The controller for our frontend pages
|   |
|   └── Providers  
|       └── AppServiceProvider.php    # Used to inject the Corbado project ID into all views
|
├── resources
|   └── views
|       ├── index.blade.php           # The login page
|       └── profile.blade.php         # The profile page
|
└── routes
    └── web.php                       # The routes for our frontend pages

Prerequisites

Please follow the steps in Getting started to create and configure a project in the Corbado developer panel.

Create a .env file with the contents of the .env.example file and paste your own project ID as well as your own API secret.

Also make sure that you have PHP as well as Composer installed and accessible from your shell.

Usage

Then you can run the project locally by first downloading all dependencies with composer install and then starting the local instance with php artisan serve.