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: https://github.com/magiclabs/magic-admin-php

important

Our Laravel SDK magic-laravel is released now.

👉 Magic Laravel SDK

#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

01composer require magiclabs/magic-admin-php

To use the bindings, use Composer's autoload:

PHP
01require_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.

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

#Creating an SDK Instance

To instantiate:

PHP
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?