PHP class for creating passes for Wallet on iOS.
This class provides the functionality to create passes for Wallet in Apple's iOS. It creates,
signs and packages the pass as a .pkpass file according to Apple's documentation.
Simply run the following command in your project's root directory to install via Composer:
composer require pkpass/pkpassOr add to your composer.json: "pkpass/pkpass": "^2.0.0"
Please take a look at the examples/example.php file for example usage. For more info on the JSON for the pass and how to style it, take a look at the docs at developers.apple.com.
API documentation is available for all main classes:
.pkpasses fileExport 2 items…..p12) as described above and upload it to your server.passTypeIdentifier and teamIndentifier to the correct values on lines 29 and 31 (teamIndentifier can be found on the Developer Portal).After completing these steps, you should be ready to go. Upload all the files to your server and navigate to the address of the examples/example.php file on your iPhone.
If you aren't able to open your pass on an iPhone, plug the iPhone into a Mac and open the 'Console' application. On the left, you can select your iPhone. You will then be able to inspect any errors that occur while adding the pass:
Trust evaluate failure: [leaf TemporalValidity]: If you see this error, your pass was signed with an outdated certificate.Trust evaluate failure: [leaf LeafMarkerOid]: You did not leave the name of the certificate empty while creating it in the developer portal.When you get the error 'Could not read certificate file', this might be related to using an OpenSSL version that has deprecated some older hashes - more info here.
There may be no need to configure OpenSSL to use legacy algorithms. It's easier and more portable just to convert the encrypted certificates file. The steps below use a .p12 file but it should work to swap these commands for a .pfx file.
Instructions:
openssl pkcs12 -legacy -in key.p12 -nodes -out key_decrypted.tmp (replace key.p12 with your .p12 file name).openssl pkcs12 -in key_decrypted.tmp -export -out key_new.p12 -certpbe AES-256-CBC -keypbe AES-256-CBC -iter 2048 (use the newly generated key_new.p12 file in your pass generation below)The key_new.p12 file should now be compatible with OpenSSL v3+.
Version 2.5.1 - January 2026
Version 2.5.0 - September 2025
Push class to handle push notifications for pass updates via APNS.Version 2.4.0 - June 2025
PKPassBundle class to bundle multiple passes into a single .pkpasses file.Version 2.3.2 - September 2024
Version 2.3.1 - March 2024
Version 2.3.0 - February 2024
Version 2.2.0 - December 2023
Version 2.1.0 - April 2023
Version 2.0.2 - October 2022
ZipArchive::OVERWRITE method of opening ZIP due to PHP 8 deprecation (#120).Version 2.0.1 - October 2022
Version 2.0.0 - September 2022
$json parameter.setJSON() method.checkError() and getError() methods in favor of exceptions.Please read the instructions above and consult the Wallet Documentation before submitting tickets or requesting support. It might also be worth to check Stackoverflow, which contains quite a few questions about this library.
No open issues yet, or sync has not completed.