PHPackages                             azimolabs/apple-sign-in-php-sdk - 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. azimolabs/apple-sign-in-php-sdk

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

azimolabs/apple-sign-in-php-sdk
===============================

Library to verify and validate Apple IdentityToken and authenticate a user with Apple ID.

3.0.0(2y ago)92463.9k↓13%30[1 issues](https://github.com/AzimoLabs/apple-sign-in-php-sdk/issues)MITPHPPHP ^8.1

Since Aug 6Pushed 2y ago6 watchersCompare

[ Source](https://github.com/AzimoLabs/apple-sign-in-php-sdk)[ Packagist](https://packagist.org/packages/azimolabs/apple-sign-in-php-sdk)[ RSS](/packages/azimolabs-apple-sign-in-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (21)Used By (0)

Sign-in with Apple SDK
======================

[](#sign-in-with-apple-sdk)

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

[](#installation)

Recommended and easiest way to installing library is through [Composer](https://getcomposer.org/).

`composer require azimolabs/apple-sign-in-php-sdk`

Requirements
------------

[](#requirements)

- PHP 7.1+
- OpenSSL Extension

PHP support
-----------

[](#php-support)

PHP versionLibrary version`5.x``NOT SUPPORTED``> 7.0 = 7.4 < 8.0``1.5.x``>= 8.0 & ^7.4``2.0.x``>= 8.1``3.0.x`Versioning follows [semver](https://semver.org/) standard.

How it works
------------

[](#how-it-works)

This description assumes that you already have generated [identityToken](https://developer.apple.com/documentation/authenticationservices/asauthorizationsinglesignoncredential/3153080-identitytoken). Remember that token is valid ONLY for 10 minutes.

The first step to verify the identity token is to generate a public key. To generate public key `exponent` and `modulus`values are required. Both information are exposed in [Apple API endpoint](https://appleid.apple.com/auth/keys). Those values differ depending on the algorithm.

The second step is verification if provided `identityToken` is valid against generated public key. If so we are sure that `identityToken` wasn't malformed.

The third step is validation if token is not expired. Additionally it is worth to check `issuer` and `audience`, examples are shown below.

Basic usage
-----------

[](#basic-usage)

Once you have cloned repository, make sure that composer dependencies are installed running `composer install -o`.

```
$appleJwtFetchingService = new Auth\Service\AppleJwtFetchingService(
            new Auth\Jwt\JwtParser(new \Lcobucci\JWT\Token\Parser(new \Lcobucci\JWT\Encoding\JoseEncoder())),
            new Auth\Jwt\JwtVerifier(
                new Api\AppleApiClient(
                    new GuzzleHttp\Client(
                        [
                            'base_uri'        => 'https://appleid.apple.com',
                            'timeout'         => 5,
                            'connect_timeout' => 5,
                        ]
                    ),
                    new Api\Factory\ResponseFactory()
                ),
                new \Lcobucci\JWT\Validation\Validator(),
                new \Lcobucci\JWT\Signer\Rsa\Sha256()
            ),
            new Auth\Jwt\JwtValidator(
                new \Lcobucci\JWT\Validation\Validator(),
                [
                    new \Lcobucci\JWT\Validation\Constraint\IssuedBy('https://appleid.apple.com'),
                    new \Lcobucci\JWT\Validation\Constraint\PermittedFor('com.c.azimo.stage'),
                ]
            ),
            new Auth\Factory\AppleJwtStructFactory()
        );

$appleJwtFetchingService->getJwtPayload('your.identity.token');
```

If you don't want to copy-paste above code you can paste freshly generated `identityToken`in `tests/E2e/Auth/AppleJwtFetchingServiceTest.php:53`and run tests with simple command `php vendor/bin/phpunit tests/E2e`.

```
$ php vendor/bin/phpunit tests/E2e
PHPUnit 9.2.5 by Sebastian Bergmann and contributors.

Random seed:   1594414420

.                                                                   1 / 1 (100%)

Time: 00:00.962, Memory: 8.00 MB

OK (1 test, 1 assertion)
```

Todo
----

[](#todo)

It is welcome to open a pull request with a fix for any issue:

- Upgrade `phpseclib/phpseclib` to version `3.0.7`
- Upgrade `lcobucci/jwt` to version `4.x`. Reported in: [Implicit conversion of keys from strings is deprecated. #2](https://github.com/AzimoLabs/apple-sign-in-php-sdk/issues/2)
- Make library compatible with PHP `7.4.3`. Reported in [Uncaught JsonException: Malformed UTF-8 characters](https://github.com/AzimoLabs/apple-sign-in-php-sdk/issues/4)
- Make library compatible with PHP `8.0.0`
- Refactor \\Azimo\\Apple\\Api\\Enum\\CryptographicAlgorithmEnum, so algorithms are fetched dynamically from
- Create contribution guide

Miscellaneous
-------------

[](#miscellaneous)

- [JSON web token](https://jwt.io/)
- [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)
- [How backend token verification works](https://sarunw.com/posts/sign-in-with-apple-3/)

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 79.3% of commits — single point of failure

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 ~57 days

Recently: every ~124 days

Total

20

Last Release

1013d ago

Major Versions

1.5.0 → 2.0.02021-06-25

1.1.1 → 2.1.02022-01-25

1.1.2 → 2.2.02022-02-04

1.5.1 → 3.0.02023-08-09

PHP version history (4 changes)1.0.0PHP ^7.1

1.5.0PHP &gt;=7.4

2.0.0PHP ^7.4 || ^8.0

3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/75b984bf506eea209fb92bd1285c44f88fc7b4c30759072003c3e4e21695b87e?d=identicon)[hywak](/maintainers/hywak)

---

Top Contributors

[![hywak](https://avatars.githubusercontent.com/u/6725710?v=4)](https://github.com/hywak "hywak (65 commits)")[![bastienuh](https://avatars.githubusercontent.com/u/1685778?v=4)](https://github.com/bastienuh "bastienuh (4 commits)")[![gerardnll](https://avatars.githubusercontent.com/u/2018022?v=4)](https://github.com/gerardnll "gerardnll (4 commits)")[![devedup](https://avatars.githubusercontent.com/u/326602?v=4)](https://github.com/devedup "devedup (3 commits)")[![frogermcs](https://avatars.githubusercontent.com/u/407504?v=4)](https://github.com/frogermcs "frogermcs (2 commits)")[![smconnor](https://avatars.githubusercontent.com/u/86208970?v=4)](https://github.com/smconnor "smconnor (1 commits)")[![ovidiuenache](https://avatars.githubusercontent.com/u/20539991?v=4)](https://github.com/ovidiuenache "ovidiuenache (1 commits)")[![reibengu](https://avatars.githubusercontent.com/u/4273878?v=4)](https://github.com/reibengu "reibengu (1 commits)")[![shaggy8871](https://avatars.githubusercontent.com/u/5216660?v=4)](https://github.com/shaggy8871 "shaggy8871 (1 commits)")

---

Tags

appleapple-sign-inhacktoberfestiosjwkjwtphpphp-libraryphp7sign-insign-in-with-appleappleapple sign inapple idApple log inApple authentication

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/azimolabs-apple-sign-in-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/azimolabs-apple-sign-in-php-sdk/health.svg)](https://phpackages.com/packages/azimolabs-apple-sign-in-php-sdk)
```

###  Alternatives

[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[socialiteproviders/apple

Apple OAuth2 Provider for Laravel Socialite

618.4M8](/packages/socialiteproviders-apple)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[ahilmurugesan/socialite-apple-helper

Laravel Socialite Apple Login Helper to generate and manage Client Secret

13120.7k](/packages/ahilmurugesan-socialite-apple-helper)[currencyfair/apple-sign-in-php-client

PHP Client for Apple Sign-In

1497.8k](/packages/currencyfair-apple-sign-in-php-client)[simplesamlphp/simplesamlphp-module-oidc

A SimpleSAMLphp module adding support for the OpenID Connect protocol

5016.9k1](/packages/simplesamlphp-simplesamlphp-module-oidc)

PHPackages © 2026

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