PHP PKPass class for iOS 6 Passbook
This class provides the functionality to create an Pass for Passbook in Apple's iOS 6 and newer on-the-fly. It creates, signs and packages the Pass as a .pkpass file according to Apple's documentation.
- PHP 5.4
- PHP ZIP Support (May be installed by default)
- Access to filesystem (Script must be able to create temporary folders)
$ composer require pkpass/pkpass
or add to your composer.json:
Require PKPass.php file in your php files
- Simple example (example.php): http://apps.tomttb.com/pkpass/example.php
- Full example (full_sample/index.php): http://apps.tomttb.com/pkpass/full_sample
Note: this example shows how to support localized keys.
- Starbucks example (starbucks_sample/index.php): http://apps.tomttb.com/pkpass/starbucks_sample
Requesting the Pass Certificate
- Go to the iOS Provisioning portal
- Create a new Pass Type ID
- Request the certificate like shown
- Download the .cer file and drag it into Keychain Access
- Right click the certificate in Keychain Access and choose
- Choose a password and export the file to a folder
Getting the example.php sample to work
- Request the Pass certificate (
.p12) and upload it to your server
- Set the correct path and password on line 6 and 7
- Download and import your WWDR Intermediate certificate to Keychain, export as
.pemand set the correct path on line 8
- Change the
teamIndentifierto the correct values, which can be found on the iOS Provisioning portal after clicking on 'Configure' next to the Pass ID, on line 15 and 17
After completing these steps, you should be ready to go. Upload all the files to your server and navigate to the address of the example.php file on your iPhone.
Support & documentation
Please read the instructions above and consult the Passbook Documentation before submitting tickets or requesting support.
Email me at tom [at] tomttb.com or tweet me @tschoffelen.
Send me a coffee
Like my work? Consider giving a small donation.