Get Started

Reference for the Magic Admin SDK for PHP: https://github.com/magiclabs/magic-admin-php

note

We will also be releasing magic-admin-laravel to offer the direct magic-admin SDK integration for the PHP Web frameworks.

Overview

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

note

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

๐Ÿ‘‰ Magic Client SDK for web

๐Ÿ‘‰ Magic Client SDK for React Native

Installation

Current SDK is built with PHP 5.6.0 and later.

composer require magiclabs/magic-admin-php

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

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

require_once('/path/to/magic-admin-php/init.php');

Creating an SDK Instance

To instantiate:

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