{"id":29332468,"url":"https://github.com/AzimoLabs/apple-sign-in-php-sdk","last_synced_at":"2025-07-08T01:31:48.536Z","repository":{"id":42390951,"uuid":"285619046","full_name":"AzimoLabs/apple-sign-in-php-sdk","owner":"AzimoLabs","description":"PHP library to verify and validate Apple IdentityToken and authenticate a user with Apple ID.","archived":false,"fork":false,"pushed_at":"2023-10-22T12:40:46.000Z","size":96,"stargazers_count":91,"open_issues_count":1,"forks_count":30,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-30T10:47:39.053Z","etag":null,"topics":["apple","apple-sign-in","hacktoberfest","ios","jwk","jwt","php","php-library","php7","sign-in","sign-in-with-apple"],"latest_commit_sha":null,"homepage":"","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/AzimoLabs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-06T16:28:18.000Z","updated_at":"2025-06-28T15:40:49.000Z","dependencies_parsed_at":"2024-06-19T00:28:06.277Z","dependency_job_id":null,"html_url":"https://github.com/AzimoLabs/apple-sign-in-php-sdk","commit_stats":{"total_commits":65,"total_committers":9,"mean_commits":7.222222222222222,"dds":"0.49230769230769234","last_synced_commit":"97dc4c1faa008ccebda516193c1f961f23b3f5e3"},"previous_names":[],"tags_count":17,"template":true,"template_full_name":null,"purl":"pkg:github/AzimoLabs/apple-sign-in-php-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzimoLabs%2Fapple-sign-in-php-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzimoLabs%2Fapple-sign-in-php-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzimoLabs%2Fapple-sign-in-php-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzimoLabs%2Fapple-sign-in-php-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AzimoLabs","download_url":"https://codeload.github.com/AzimoLabs/apple-sign-in-php-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzimoLabs%2Fapple-sign-in-php-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264175387,"owners_count":23568452,"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":["apple","apple-sign-in","hacktoberfest","ios","jwk","jwt","php","php-library","php7","sign-in","sign-in-with-apple"],"created_at":"2025-07-08T01:31:44.289Z","updated_at":"2025-07-08T01:31:48.530Z","avatar_url":"https://github.com/AzimoLabs.png","language":"PHP","funding_links":[],"categories":["库和框架"],"sub_categories":["PHP"],"readme":"# Sign-in with Apple SDK\n\n## Installation\n\nRecommended and easiest way to installing library is through [Composer](https://getcomposer.org/).\n\n`composer require azimolabs/apple-sign-in-php-sdk`\n\n## Requirements\n\n* PHP 7.1+\n* OpenSSL Extension\n\n## PHP support\n| PHP version     | Library version |\n|-----------------|-----------------|\n| `5.x`           | `NOT SUPPORTED` |\n| `\u003e 7.0 \u003c= 7.3`  | `1.4.x`         |\n| `\u003e= 7.4 \u003c 8.0`  | `1.5.x`         |\n| `\u003e= 8.0 \u0026 ^7.4` | `2.0.x`         |\n| `\u003e= 8.1`        | `3.0.x`         |\n\nVersioning follows [semver](https://semver.org/) standard.\n\n## How it works\n\nThis description assumes that you already have\ngenerated [identityToken](https://developer.apple.com/documentation/authenticationservices/asauthorizationsinglesignoncredential/3153080-identitytoken)\n. Remember that token is valid ONLY for 10 minutes.\n\nThe first step to verify the identity token is to generate a public key. To generate public key `exponent` and `modulus`\nvalues are required. Both information are exposed in [Apple API endpoint](https://appleid.apple.com/auth/keys). Those\nvalues differ depending on the algorithm.\n\nThe second step is verification if provided `identityToken` is valid against generated public key. If so we are sure\nthat `identityToken` wasn't malformed.\n\nThe third step is validation if token is not expired. Additionally it is worth to check `issuer` and `audience`,\nexamples are shown below.\n\n## Basic usage\n\nOnce you have cloned repository, make sure that composer dependencies are installed running `composer install -o`.\n\n```php\n\n$appleJwtFetchingService = new Auth\\Service\\AppleJwtFetchingService(\n            new Auth\\Jwt\\JwtParser(new \\Lcobucci\\JWT\\Token\\Parser(new \\Lcobucci\\JWT\\Encoding\\JoseEncoder())),\n            new Auth\\Jwt\\JwtVerifier(\n                new Api\\AppleApiClient(\n                    new GuzzleHttp\\Client(\n                        [\n                            'base_uri'        =\u003e 'https://appleid.apple.com',\n                            'timeout'         =\u003e 5,\n                            'connect_timeout' =\u003e 5,\n                        ]\n                    ),\n                    new Api\\Factory\\ResponseFactory()\n                ),\n                new \\Lcobucci\\JWT\\Validation\\Validator(),\n                new \\Lcobucci\\JWT\\Signer\\Rsa\\Sha256()\n            ),\n            new Auth\\Jwt\\JwtValidator(\n                new \\Lcobucci\\JWT\\Validation\\Validator(),\n                [\n                    new \\Lcobucci\\JWT\\Validation\\Constraint\\IssuedBy('https://appleid.apple.com'),\n                    new \\Lcobucci\\JWT\\Validation\\Constraint\\PermittedFor('com.c.azimo.stage'),\n                ]\n            ),\n            new Auth\\Factory\\AppleJwtStructFactory()\n        );\n\n$appleJwtFetchingService-\u003egetJwtPayload('your.identity.token');\n```\n\nIf you don't want to copy-paste above code you can paste freshly generated `identityToken`\nin `tests/E2e/Auth/AppleJwtFetchingServiceTest.php:53`\nand run tests with simple command `php vendor/bin/phpunit tests/E2e`.\n\n```shell script\n$ php vendor/bin/phpunit tests/E2e\nPHPUnit 9.2.5 by Sebastian Bergmann and contributors.\n\nRandom seed:   1594414420\n\n.                                                                   1 / 1 (100%)\n\nTime: 00:00.962, Memory: 8.00 MB\n\nOK (1 test, 1 assertion)\n```\n\n## Todo\n\nIt is welcome to open a pull request with a fix for any issue:\n\n- [x] Upgrade `phpseclib/phpseclib` to version `3.0.7`\n- [x] Upgrade `lcobucci/jwt` to version `4.x`. Reported\n  in: [Implicit conversion of keys from strings is deprecated. #2](https://github.com/AzimoLabs/apple-sign-in-php-sdk/issues/2)\n- [x] Make library compatible with PHP `7.4.3`. Reported\n  in [Uncaught JsonException: Malformed UTF-8 characters](https://github.com/AzimoLabs/apple-sign-in-php-sdk/issues/4)\n- [x] Make library compatible with PHP `8.0.0`\n- [x] Refactor \\Azimo\\Apple\\Api\\Enum\\CryptographicAlgorithmEnum, so algorithms are fetched dynamically from https://appleid.apple.com/auth/keys\n- [ ] Create contribution guide\n\n## Miscellaneous\n\n* [JSON web token](https://jwt.io/)\n* [Sign in with Apple overwiew](https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple)\n* [How backend token verification works](https://sarunw.com/posts/sign-in-with-apple-3/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzimoLabs%2Fapple-sign-in-php-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAzimoLabs%2Fapple-sign-in-php-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzimoLabs%2Fapple-sign-in-php-sdk/lists"}