{"id":29182811,"url":"https://github.com/magiclabs/magic-admin-php","last_synced_at":"2025-07-18T22:38:36.119Z","repository":{"id":39581618,"uuid":"292114630","full_name":"magiclabs/magic-admin-php","owner":"magiclabs","description":"Magic admin PHP SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.","archived":false,"fork":false,"pushed_at":"2023-07-10T17:42:06.000Z","size":161,"stargazers_count":21,"open_issues_count":2,"forks_count":5,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-06-26T04:46:32.375Z","etag":null,"topics":["authentication","identity","passwordless","php"],"latest_commit_sha":null,"homepage":"https://docs.magic.link/admin-sdk/php","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiclabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-01T21:47:57.000Z","updated_at":"2025-06-09T19:10:42.000Z","dependencies_parsed_at":"2024-06-21T13:05:48.034Z","dependency_job_id":"2a238cba-9f52-47de-abdc-313dd09cda21","html_url":"https://github.com/magiclabs/magic-admin-php","commit_stats":{"total_commits":50,"total_committers":8,"mean_commits":6.25,"dds":0.6,"last_synced_commit":"f64c10afd4bbfe46cea0c56266b9876cc8a72377"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/magiclabs/magic-admin-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclabs%2Fmagic-admin-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclabs%2Fmagic-admin-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclabs%2Fmagic-admin-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclabs%2Fmagic-admin-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclabs","download_url":"https://codeload.github.com/magiclabs/magic-admin-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclabs%2Fmagic-admin-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265846988,"owners_count":23838168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","identity","passwordless","php"],"created_at":"2025-07-01T20:32:57.760Z","updated_at":"2025-07-18T22:38:36.073Z","avatar_url":"https://github.com/magiclabs.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magic Admin PHP SDK\n\nThe 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).\n\n## Table of Contents\n\n* [Documentation](#documentation)\n* [Installation](#installation)\n* [Quick Start](#quick-start)\n* [Changelog](#changelog)\n* [License](#license)\n\n## Documentation\nSee the [Magic doc](https://magic.link/docs/auth/api-reference/server-side-sdks/php)!\n\n## Installation\n\n### Composer\n\nYou can install the bindings via [Composer](https://getcomposer.org/). Run the following command:\n\n```bash\ncomposer require magiclabs/magic-admin-php\n```\n\nTo use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):\n\n```php\nrequire_once __DIR__ . '/vendor/autoload.php';\n```\n\n### Manual Installation\n\nIf 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.\n\n```php\nrequire_once __DIR__ . '/path/to/magic-admin-php/init.php';\n```\n\n### Dependencies\n\nThe 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.\n\n- [`curl`](https://secure.php.net/manual/en/book.curl.php)\n- [`gmp`](https://www.php.net/manual/en/book.gmp.php) or [`bcmath`](https://www.php.net/manual/en/book.bc.php) see below\n\nFor 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`.\n\nSince `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.\n\n### Prerequisites\n\nPHP 5.6.0 and later.\n\n## Quick Start\n\nSimple usage for login:\n\n```php\n  require_once __DIR__ . '/vendor/autoload.php';\n\n  $did_token = \\MagicAdmin\\Util\\Http::parse_authorization_header_value(\n    $authorization_header\n  );\n\n  if ($did_token === null) {\n    // DIDT is missing from the original HTTP request header. You can handle this by\n    // remapping it to your application error.\n  }\n\n  $magic = new \\MagicAdmin\\Magic('\u003cYOUR_API_SECRET_KEY\u003e');\n\n  try {\n    $magic-\u003etoken-\u003evalidate($did_token);\n    $issuer = $magic-\u003etoken-\u003eget_issuer($did_token);\n  } catch (\\MagicAdmin\\Exception\\DIDTokenException $e) {\n    // DIDT is malformed. You can handle this by remapping it\n    // to your application error.\n  }\n```\n\n### Configure Network Strategy\n\nThe `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.\n\n```php\n$magic = new \\MagicAdmin\\Magic(\n  '\u003cYOUR_API_SECRET_KEY\u003e',\n  5,    // timeout\n  3,    // retries\n  0.01  // backoff\n);\n```\n\nSee more examples from [Magic PHP doc](https://docs.magic.link/admin-sdk/php/examples/user-signup).\n\n## Development\n\nGet [Composer](https://getcomposer.org/). For example, on Mac OS:\n\n```bash\nbrew install composer\n```\n\nInstall dependencies:\n\n```bash\ncomposer install\n```\n\nInstall dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:\n\n```bash\n./vendor/bin/phpunit tests/\n```\n\nOr to run an individual test file:\n\n```bash\n./vendor/bin/phpunit tests/MagicTest.php\n```\n\nThe library uses [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) for code formatting.\nPHP CS Fixer must be [installed globally](https://cs.symfony.com/doc/installation.html).\nCode must be formatted before PRs are submitted. Run the formatter with:\n\n```bash\nphp-cs-fixer fix -v --using-cache=no .\n```\n\n## Changelog\n\nSee [Changelog](./CHANGELOG.md)\n\n## License\n\nSee [License](./LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclabs%2Fmagic-admin-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclabs%2Fmagic-admin-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclabs%2Fmagic-admin-php/lists"}