Magic for PHP

Magic for PHP

PHP implementation guide

How to secure PHP REST API with Magic

View guide

Reference for the Magic Admin SDK for PHP:


Our Laravel SDK magic-laravel is released now.

👉 Magic Laravel SDK


The Magic SDK for server-side PHP 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 Admin 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 with PHP 5.6.0 and later.


01composer require magiclabs/magic-admin-php

To use the bindings, use Composer's autoload:


If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.


#Creating an SDK Instance

To instantiate:

01# Pass your API secret key directly to the Magic.
02$magic = new \MagicAdmin\Magic('<YOUR_API_SECRET_KEY>');

Did you find what you were looking for?

Did you find what you were looking for?