PHPackages                             magiclabs/magic-admin-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. magiclabs/magic-admin-php

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

magiclabs/magic-admin-php
=========================

Magic Admin PHP Library

v1.0.0(2y ago)1946.9k↓12.5%6[2 issues](https://github.com/magiclabs/magic-admin-php/issues)[1 PRs](https://github.com/magiclabs/magic-admin-php/pulls)1MITPHPPHP &gt;=5.6.0

Since Nov 3Pushed 2y ago19 watchersCompare

[ Source](https://github.com/magiclabs/magic-admin-php)[ Packagist](https://packagist.org/packages/magiclabs/magic-admin-php)[ Docs](https://magic.link)[ RSS](/packages/magiclabs-magic-admin-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (10)Used By (1)

Magic Admin PHP SDK
===================

[](#magic-admin-php-sdk)

The Magic Admin PHP SDK provides convenient ways for developers to interact with Magic API endpoints and an array of utilities to handle [DID Token](https://docs.magic.link/tutorials/decentralized-id).

Table of Contents
-----------------

[](#table-of-contents)

- [Documentation](#documentation)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Changelog](#changelog)
- [License](#license)

Documentation
-------------

[](#documentation)

See the [Magic doc](https://magic.link/docs/auth/api-reference/server-side-sdks/php)!

Installation
------------

[](#installation)

### Composer

[](#composer)

You can install the bindings via [Composer](https://getcomposer.org/). Run the following command:

```
composer require magiclabs/magic-admin-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once __DIR__ . '/vendor/autoload.php';
```

### Manual Installation

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/magiclabs/magic-admin-php). Then, to use the bindings, include the `init.php` file.

```
require_once __DIR__ . '/path/to/magic-admin-php/init.php';
```

### Dependencies

[](#dependencies)

The bindings require the following extensions in order to work properly. If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

- [`curl`](https://secure.php.net/manual/en/book.curl.php)
- [`gmp`](https://www.php.net/manual/en/book.gmp.php) or [`bcmath`](https://www.php.net/manual/en/book.bc.php) see below

For optimal performance ensure that your platform has the `gmp` extension installed. If your platform does not support `gmp` then `bcmath` may be used as an alternative, but note that `bcmath` is significantly slower than `gmp`.

Since `gmp` is a required dependency you may need to use the `--ignore-platform-reqs` flag when runnining `composer install` on a platform without the `gmp` extension.

### Prerequisites

[](#prerequisites)

PHP 5.6.0 and later.

Quick Start
-----------

[](#quick-start)

Simple usage for login:

```
  require_once __DIR__ . '/vendor/autoload.php';

  $did_token = \MagicAdmin\Util\Http::parse_authorization_header_value(
    $authorization_header
  );

  if ($did_token === null) {
    // DIDT is missing from the original HTTP request header. You can handle this by
    // remapping it to your application error.
  }

  $magic = new \MagicAdmin\Magic('');

  try {
    $magic->token->validate($did_token);
    $issuer = $magic->token->get_issuer($did_token);
  } catch (\MagicAdmin\Exception\DIDTokenException $e) {
    // DIDT is malformed. You can handle this by remapping it
    // to your application error.
  }
```

### Configure Network Strategy

[](#configure-network-strategy)

The `Magic` object also takes in `retries`, `timeout` and `backoff` as optional arguments at the object instantiation time so you can override those values for your application setup.

```
$magic = new \MagicAdmin\Magic(
  '',
  5,    // timeout
  3,    // retries
  0.01  // backoff
);
```

See more examples from [Magic PHP doc](https://docs.magic.link/admin-sdk/php/examples/user-signup).

Development
-----------

[](#development)

Get [Composer](https://getcomposer.org/). For example, on Mac OS:

```
brew install composer
```

Install dependencies:

```
composer install
```

Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:

```
./vendor/bin/phpunit tests/
```

Or to run an individual test file:

```
./vendor/bin/phpunit tests/MagicTest.php
```

The library uses [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) for code formatting. PHP CS Fixer must be [installed globally](https://cs.symfony.com/doc/installation.html). Code must be formatted before PRs are submitted. Run the formatter with:

```
php-cs-fixer fix -v --using-cache=no .
```

Changelog
---------

[](#changelog)

See [Changelog](./CHANGELOG.md)

License
-------

[](#license)

See [License](./LICENSE.txt)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~122 days

Recently: every ~237 days

Total

9

Last Release

1043d ago

Major Versions

v0.1.4 → v1.0.02023-07-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/15a789119a4277e982840c96fbb0aa575d29932e6f6dd2792e3bc822d8c9ce08?d=identicon)[MagicLabs](/maintainers/MagicLabs)

---

Top Contributors

[![itprodev](https://avatars.githubusercontent.com/u/69479470?v=4)](https://github.com/itprodev "itprodev (20 commits)")[![brianrlewis](https://avatars.githubusercontent.com/u/31142584?v=4)](https://github.com/brianrlewis "brianrlewis (14 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (5 commits)")[![magic-ravi](https://avatars.githubusercontent.com/u/89037241?v=4)](https://github.com/magic-ravi "magic-ravi (3 commits)")[![ayv8er](https://avatars.githubusercontent.com/u/84942969?v=4)](https://github.com/ayv8er "ayv8er (1 commits)")[![justinnout](https://avatars.githubusercontent.com/u/116202207?v=4)](https://github.com/justinnout "justinnout (1 commits)")

---

Tags

authenticationidentitypasswordlessphplinkAuthenticationoauth2adminPasswordlessmagicwebauthen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/magiclabs-magic-admin-php/health.svg)

```
[![Health](https://phpackages.com/badges/magiclabs-magic-admin-php/health.svg)](https://phpackages.com/packages/magiclabs-magic-admin-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
