Magic for Laravel

Magic for Laravel

Reference for the Magic Admin SDK for Laravel:


Looking for a PHP SDK instead? Check out:

👉 Magic Admin SDK for PHP


The Magic Laravel SDK makes it easy to leverage Decentralized ID Tokens to authenticate your users for your app. This guide will cover some important topics for getting started with server-side APIs and to make the most of Magic's features.

  • Install the Magic Laravel SDK to get started
  • View the API documentation below to learn the methods you'll be using
  • Go to Examples for an introduction to common patterns and use-cases

Looking for a client-side API instead? Check out:

👉 Magic Client SDK for web

👉 Magic Client SDK for React Native


Current SDK is built for Laravel 5.3 or newer.


You can install the bindings via Composer. Run the following command:

composer require magiclabs/magic-laravel

Older Laravel Installation

If you are using Laravel 5.5 or newer then skip this part. Otherwise you will need to manually register the service provider and facade alias by going to config/app.php

Add to the providers array:


Add to the aliases array:

'Magic' => MagicLaravel\Facade::class


Publish config file.

php artisan vendor:publish --provider="MagicLaravel\ServiceProvider"

Add MAGIC_SECRET_API_KEY to your .env file by going to the Magic Dashboard.


#Creating an SDK Instance

#Get instance using the app helper

$magic = app('MagicLaravel\Magic');



#Get instance using the facade

use Magic;



Did you find what you were looking for?