{"id":20790366,"url":"https://github.com/paragonie/php-jwt-guard","last_synced_at":"2025-05-05T20:44:04.354Z","repository":{"id":57035842,"uuid":"394948209","full_name":"paragonie/php-jwt-guard","owner":"paragonie","description":"Security Defense for Firebase's PHP-JWT Library","archived":false,"fork":false,"pushed_at":"2021-08-11T21:28:40.000Z","size":13,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-16T13:06:15.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paragonie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-11T10:19:48.000Z","updated_at":"2023-10-13T07:22:12.000Z","dependencies_parsed_at":"2022-08-24T06:40:09.009Z","dependency_job_id":null,"html_url":"https://github.com/paragonie/php-jwt-guard","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fphp-jwt-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fphp-jwt-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fphp-jwt-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fphp-jwt-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paragonie","download_url":"https://codeload.github.com/paragonie/php-jwt-guard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252573834,"owners_count":21770292,"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":[],"created_at":"2024-11-17T15:34:22.772Z","updated_at":"2025-05-05T20:44:04.334Z","avatar_url":"https://github.com/paragonie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP-JWT-Guard\n\n[![Build Status](https://github.com/paragonie/php-jwt-guard/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/php-jwt-guard/actions)\n[![Latest Stable Version](https://poser.pugx.org/paragonie/php-jwt-guard/v/stable)](https://packagist.org/packages/paragonie/php-jwt-guard)\n[![Latest Unstable Version](https://poser.pugx.org/paragonie/php-jwt-guard/v/unstable)](https://packagist.org/packages/paragonie/php-jwt-guard)\n[![License](https://poser.pugx.org/paragonie/php-jwt-guard/license)](https://packagist.org/packages/paragonie/php-jwt-guard)\n[![Downloads](https://img.shields.io/packagist/dt/paragonie/php-jwt-guard.svg)](https://packagist.org/packages/paragonie/php-jwt-guard)\n\n\nProtect your code from being impacted by \n[issue 351 in firebase/php-jwt](https://github.com/firebase/php-jwt/issues/351).  \n\n## Installation\n\nFirst, install this library with Composer:\n\n```terminal\ncomposer require paragonie/php-jwt-guard\n```\n\nAnd then in your PHP namespace imports, swap the namespace:\n\n```diff\n- use Firebase\\JWT\\JWT;\n+ use ParagonIE\\PhpJwtGuard\\JWT;\n```\n\nYou're no longer going to provide an array or ArrayAccess object\nto `JWT`. You will instead need to use the provided `KeyRing` class.\n\n```php\n\u003c?php\nuse ParagonIE\\PhpJwtGuard\\KeyRing;\nuse ParagonIE\\PhpJwtGuard\\JWT;\n\n// Setup keyring:\n$keyring = (new KeyRing())\n    -\u003ewithHS256('key-id-foo', 'raw-key-data-goes-here')\n    -\u003ewithHS384('key-id-bar', 'raw-key-data-goes-here-too')\n    // ...\n    -\u003ewithPS384('key-id-xyzzy', 'raw-key-data-goes-here-too')\n    -\u003ewithPS512('key-id-thud', 'raw-key-data-goes-here-too');\n\n// Pass it to JWT Dcode:\nJWT::decode($jwt, $keyring, array($allowedAlgs));\n```\n\n### Using the KeyRing class\n\n#### KeyRing-\u003ewith($alg, $keyId, $rawKeyData)\n\nParameters:\n\n1. `string` $alg - The algorithm this key is intended for\n2. `string` $keyId - The `kid` header that maps to this key\n3. `string` $rawKeyData - The actual key material. For asymmetric keys,\n   this is usually PEM-encoded.\n\nReturns the KeyRing object. Chainable.\n\n### KeyRing-\u003ecount()\n\nReturns an integer.\n\n### KeyRing-\u003epartition($alg)\n\nParameters:\n\n1. `string` $alg - The algorithm this key is intended for\n\nReturns a new KeyRing object with a subset of all supported keys.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Fphp-jwt-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparagonie%2Fphp-jwt-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Fphp-jwt-guard/lists"}