PHPackages                             pkpass/pkpass - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pkpass/pkpass

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pkpass/pkpass
=============

PHP PKPass class for iOS Wallet

v2.5.1(4mo ago)9733.0M—7%193[1 PRs](https://github.com/tschoffelen/php-pkpass/pulls)5MITPHPPHP &gt;=7.0CI passing

Since Feb 7Pushed 4mo ago54 watchersCompare

[ Source](https://github.com/tschoffelen/php-pkpass)[ Packagist](https://packagist.org/packages/pkpass/pkpass)[ Docs](https://github.com/includable/php-pkpass)[ GitHub Sponsors](https://github.com/tschoffelen)[ RSS](/packages/pkpass-pkpass/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (26)Used By (5)

PHP library to create passes for iOS Wallet
===========================================

[](#php-library-to-create-passes-for-ios-wallet)

[![Packagist Version](https://camo.githubusercontent.com/eec444a951bfa04fb4619a1856cfd254953eb30eaecae6b1c70c60ad84e9ed74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706b706173732f706b70617373)](https://packagist.org/packages/pkpass/pkpass)[![Packagist Downloads](https://camo.githubusercontent.com/4a5cf85ea0c9e57ddf4e2f13ffaa0eb1a77c4e7bfb1b022daec8b16ebee23e99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706b706173732f706b70617373)](https://packagist.org/packages/pkpass/pkpass)[![Packagist License](https://camo.githubusercontent.com/1a1aed9b91ff1624a2104140c563fa0e5b095c36911ef929dc7956ae3fbd5887/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f706b706173732f706b70617373)](LICENSE)

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.

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

[](#requirements)

- PHP 7.0 or higher (may also work with older versions)
- PHP [ZIP extension](http://php.net/manual/en/book.zip.php) (often installed by default)
- Access to filesystem to write temporary cache files

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

[](#installation)

Simply run the following command in your project's root directory to install via [Composer](https://getcomposer.org/):

```
composer require pkpass/pkpass

```

Or add to your composer.json: `"pkpass/pkpass": "^2.0.0"`

Usage
-----

[](#usage)

Please take a look at the [examples/example.php](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](https://developer.apple.com/library/ios/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/Introduction.html).

### Included demos

[](#included-demos)

- 📦 [Simple example](examples/example.php)
- ✈️ [Flight ticket example](examples/full_sample/)
- ☕️ [Starbucks card example](examples/starbucks_sample/)

API Documentation
-----------------

[](#api-documentation)

API documentation is available for all main classes:

- **[PKPass API Documentation](docs/PKPass.md)** - Main class for creating Apple Wallet passes
- **[PKPassBundle API Documentation](docs/PKPassBundle.md)** - Bundle multiple passes into a single `.pkpasses` file
- **[FinanceOrder API Documentation](docs/FinanceOrder.md)** - Create Apple Wallet Orders for financial transactions
- **[Push API Documentation](docs/Push.md)** - Push updates to passes via APNS

Requesting the Pass Certificate
-------------------------------

[](#requesting-the-pass-certificate)

1. Go to the [iOS Provisioning portal](https://developer.apple.com/account/ios/identifier/passTypeId).
2. Create a new Pass Type ID, and write down the Pass ID you choose, you'll need it later.
3. Click the edit button under your newly created Pass Type ID and generate a certificate according to the instructions shown on the page. Make sure *not* to choose a name for the Certificate but keep it empty instead.
4. Download the .cer file and drag it into Keychain Access.
5. Choose to filter by **Certificates** in the top filter bar.
6. Find the certificate you just imported and click the triangle on the left to reveal the private key.
7. Select both the certificate and the private key it, then right-click the certificate in Keychain Access and choose `Export 2 items…`.
8. Choose a password and export the file to a folder.

[![Exporting P12 file](docs/guide-export.gif)](docs/guide-export.gif)

### Getting the example.php sample to work

[](#getting-the-examplephp-sample-to-work)

1. Request the Pass certificate (`.p12`) as described above and upload it to your server.
2. Set the correct path and password on [line 22](examples/example.php#L22).
3. Change the `passTypeIdentifier` and `teamIndentifier` to the correct values on lines [29](examples/example.php#L29) and [31](examples/example.php#L31) (`teamIndentifier` can be found on the [Developer Portal](https://developer.apple.com/account/#/membership)).

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.

Debugging
---------

[](#debugging)

### Using the Console app

[](#using-the-console-app)

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:

[![Console with Passkit error](docs/console.png)](docs/console.png)

- `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.

### OpenSSL errors

[](#openssl-errors)

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](https://schof.link/2Et6z3m).

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:

1. `openssl pkcs12 -legacy -in key.p12 -nodes -out key_decrypted.tmp` (replace key.p12 with your .p12 file name).
2. `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+.

Changelog
---------

[](#changelog)

**Version 2.5.1 - January 2026**

- Add support for setting the certificate from a string, allowing for more flexible certificate management.

**Version 2.5.0 - September 2025**

- Added `Push` class to handle push notifications for pass updates via APNS.

**Version 2.4.0 - June 2025**

- Add `PKPassBundle` class to bundle multiple passes into a single `.pkpasses` file.

**Version 2.3.2 - September 2024**

- Fix order mime type, add better error reporting.

**Version 2.3.1 - March 2024**

- Chore: add gitattributes.

**Version 2.3.0 - February 2024**

- Add support for Wallet Orders.

**Version 2.2.0 - December 2023**

- Update default WWDR certificate to G4.

**Version 2.1.0 - April 2023**

- Add alternative method for extracting P12 contents to circumvent issues in recent versions of OpenSSL.

**Version 2.0.2 - October 2022**

- Switch to `ZipArchive::OVERWRITE` method of opening ZIP due to PHP 8 deprecation ([\#120](https://github.com/includable/php-pkpass/pull/120)).

**Version 2.0.1 - October 2022**

- Update WWDR certificate to v6 ([\#118](https://github.com/includable/php-pkpass/issues/118)).

**Version 2.0.0 - September 2022**

- Changed signature of constructor to take out third `$json` parameter.
- Remove deprecated `setJSON()` method.
- Removed `checkError()` and `getError()` methods in favor of exceptions.

Support &amp; documentation
---------------------------

[](#support--documentation)

Please read the instructions above and consult the [Wallet Documentation](https://developer.apple.com/wallet/) before submitting tickets or requesting support. It might also be worth to [check Stackoverflow](http://stackoverflow.com/search?q=%22PHP-PKPass%22), which contains quite a few questions about this library.

---

  **[Get professional support for this package →](https://includable.com/consultancy/?utm_source=includable/php-pkpass)**
  Custom consulting sessions available for implementation support and feature development.

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance75

Regular maintenance activity

Popularity67

Solid adoption and visibility

Community41

Growing community involvement

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 70.4% 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 ~141 days

Recently: every ~162 days

Total

24

Last Release

136d ago

Major Versions

v1.2.7 → v2.0.02022-09-19

PHP version history (3 changes)v1.0.5PHP &gt;=5.4

v2.0.0PHP &gt;=5.6

v2.1.0PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1af8c1e173ab229818dff16253e9b49ce9b0ec8847311d95390760eb59f9901e?d=identicon)[tschoffelen](/maintainers/tschoffelen)

---

Top Contributors

[![tschoffelen](https://avatars.githubusercontent.com/u/666220?v=4)](https://github.com/tschoffelen "tschoffelen (140 commits)")[![mikealmond](https://avatars.githubusercontent.com/u/600744?v=4)](https://github.com/mikealmond "mikealmond (8 commits)")[![dododedodonl](https://avatars.githubusercontent.com/u/100052?v=4)](https://github.com/dododedodonl "dododedodonl (5 commits)")[![GCalmels](https://avatars.githubusercontent.com/u/5655839?v=4)](https://github.com/GCalmels "GCalmels (4 commits)")[![ptz0n](https://avatars.githubusercontent.com/u/200250?v=4)](https://github.com/ptz0n "ptz0n (4 commits)")[![ebetancourt](https://avatars.githubusercontent.com/u/757917?v=4)](https://github.com/ebetancourt "ebetancourt (4 commits)")[![ulvesked](https://avatars.githubusercontent.com/u/5374616?v=4)](https://github.com/ulvesked "ulvesked (3 commits)")[![alexander-schranz](https://avatars.githubusercontent.com/u/1698337?v=4)](https://github.com/alexander-schranz "alexander-schranz (3 commits)")[![jacksonj04](https://avatars.githubusercontent.com/u/619082?v=4)](https://github.com/jacksonj04 "jacksonj04 (3 commits)")[![artyfarty](https://avatars.githubusercontent.com/u/1222287?v=4)](https://github.com/artyfarty "artyfarty (2 commits)")[![L45eMy](https://avatars.githubusercontent.com/u/7263328?v=4)](https://github.com/L45eMy "L45eMy (2 commits)")[![cjnewbs](https://avatars.githubusercontent.com/u/1676494?v=4)](https://github.com/cjnewbs "cjnewbs (2 commits)")[![Aplkaev](https://avatars.githubusercontent.com/u/28065693?v=4)](https://github.com/Aplkaev "Aplkaev (2 commits)")[![piamancini](https://avatars.githubusercontent.com/u/3671070?v=4)](https://github.com/piamancini "piamancini (1 commits)")[![rkaiser0324](https://avatars.githubusercontent.com/u/1090569?v=4)](https://github.com/rkaiser0324 "rkaiser0324 (1 commits)")[![Robertbaelde](https://avatars.githubusercontent.com/u/4356288?v=4)](https://github.com/Robertbaelde "Robertbaelde (1 commits)")[![soukicz](https://avatars.githubusercontent.com/u/1814750?v=4)](https://github.com/soukicz "soukicz (1 commits)")[![isarphilipp](https://avatars.githubusercontent.com/u/9417412?v=4)](https://github.com/isarphilipp "isarphilipp (1 commits)")[![antonioreyna](https://avatars.githubusercontent.com/u/147514?v=4)](https://github.com/antonioreyna "antonioreyna (1 commits)")[![chao](https://avatars.githubusercontent.com/u/55872?v=4)](https://github.com/chao "chao (1 commits)")

---

Tags

iospassbookphpphp-pkpasspkpasswalletphpappleiphonewalletiospassbookipad

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pkpass-pkpass/health.svg)

```
[![Health](https://phpackages.com/badges/pkpass-pkpass/health.svg)](https://phpackages.com/packages/pkpass-pkpass)
```

###  Alternatives

[eo/passbook

iOS Passbook for PHP

2651.6M2](/packages/eo-passbook)[thenextweb/passgenerator

A Laravel package to create Apple Wallet (old Passbook) compatible tickets.

297435.6k](/packages/thenextweb-passgenerator)[griffinledingham/php-apple-signin

A simple library to decode and parse Apple Sign In client tokens.

2011.9M1](/packages/griffinledingham-php-apple-signin)[byte5/laravel-passgenerator

A Laravel package to create Apple Wallet (old Passbook) compatible tickets.

8821.3k](/packages/byte5-laravel-passgenerator)[eo/passbook-bundle

iOS Passbook for Symfony

1084.4k](/packages/eo-passbook-bundle)[chiiya/passes

PHP library for creating iOS and Android Wallet Passes

67243.1k1](/packages/chiiya-passes)

PHPackages © 2026

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