{"id":13599678,"url":"https://github.com/tschoffelen/php-pkpass","last_synced_at":"2025-05-13T19:05:26.392Z","repository":{"id":3583321,"uuid":"4646413","full_name":"tschoffelen/php-pkpass","owner":"tschoffelen","description":"💳 PHP class for creating passes for Wallet on iOS.","archived":false,"fork":false,"pushed_at":"2025-03-11T10:55:26.000Z","size":5260,"stargazers_count":940,"open_issues_count":2,"forks_count":192,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-04-27T04:35:46.957Z","etag":null,"topics":["ios","passbook","php","php-pkpass","pkpass","wallet"],"latest_commit_sha":null,"homepage":"https://includable.com","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/tschoffelen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"tschoffelen"}},"created_at":"2012-06-13T04:58:10.000Z","updated_at":"2025-04-23T14:35:46.000Z","dependencies_parsed_at":"2023-12-15T12:44:26.648Z","dependency_job_id":"8f2f1d37-529f-4d46-86d5-a941d5fe4519","html_url":"https://github.com/tschoffelen/php-pkpass","commit_stats":{"total_commits":158,"total_committers":40,"mean_commits":3.95,"dds":0.8354430379746836,"last_synced_commit":"83226a1543bbabceffcea9d22413e98bc2019146"},"previous_names":["tschoffelen/php-pkpass","includable/php-pkpass"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschoffelen%2Fphp-pkpass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschoffelen%2Fphp-pkpass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschoffelen%2Fphp-pkpass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschoffelen%2Fphp-pkpass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tschoffelen","download_url":"https://codeload.github.com/tschoffelen/php-pkpass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251089408,"owners_count":21534511,"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":["ios","passbook","php","php-pkpass","pkpass","wallet"],"created_at":"2024-08-01T17:01:08.946Z","updated_at":"2025-04-27T04:36:03.704Z","avatar_url":"https://github.com/tschoffelen.png","language":"PHP","funding_links":["https://github.com/sponsors/tschoffelen"],"categories":["PHP"],"sub_categories":[],"readme":"# PHP library to create passes for iOS Wallet\n\n[![Packagist Version](https://img.shields.io/packagist/v/pkpass/pkpass)](https://packagist.org/packages/pkpass/pkpass)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/pkpass/pkpass)](https://packagist.org/packages/pkpass/pkpass)\n[![Packagist License](https://img.shields.io/packagist/l/pkpass/pkpass)](LICENSE)\n\nThis class provides the functionality to create passes for Wallet in Apple's iOS. It creates,\nsigns and packages the pass as a `.pkpass` file according to Apple's documentation.\n\n## Requirements\n\n- PHP 7.0 or higher (may also work with older versions)\n- PHP [ZIP extension](http://php.net/manual/en/book.zip.php) (often installed by default)\n- Access to filesystem to write temporary cache files\n\n## Installation\n\nSimply run the following command in your project's root directory to install via [Composer](https://getcomposer.org/):\n\n```\ncomposer require pkpass/pkpass\n```\n\nOr add to your composer.json: `\"pkpass/pkpass\": \"^2.0.0\"`\n\n## Usage\n\nPlease 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\nstyle 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).\n\n### Included demos\n\n- 📦 [Simple example](examples/example.php)\n- ✈️ [Flight ticket example](examples/full_sample/)\n- ☕️ [Starbucks card example](examples/starbucks_sample/)\n\n### Functions to add files\n\n- `addFile` : add a file without locale like `icon.png`\n- `addRemoteFile` : add a file from a url without locale like `https://xyz.io/icon.png`\n- `addLocaleFile` : add a localized file like `strip.png`\n- `addLocaleRemoteFile` : add a localized file from a url like `https://xyz.io/strip.png`\n\n## Requesting the Pass Certificate\n\n1. Go to the [iOS Provisioning portal](https://developer.apple.com/account/ios/identifier/passTypeId).\n2. Create a new Pass Type ID, and write down the Pass ID you choose, you'll need it later.\n3. Click the edit button under your newly created Pass Type ID and generate a certificate according to the instructions\n   shown on the page. Make sure _not_ to choose a name for the Certificate but keep it empty instead.\n4. Download the .cer file and drag it into Keychain Access.\n5. Choose to filter by **Certificates** in the top filter bar.\n6. Find the certificate you just imported and click the triangle on the left to reveal the private key.\n7. Select both the certificate and the private key it, then right-click the certificate in Keychain Access and\n   choose `Export 2 items…`.\n8. Choose a password and export the file to a folder.\n\n![Exporting P12 file](docs/guide-export.gif)\n\n### Getting the example.php sample to work\n\n1. Request the Pass certificate (`.p12`) as described above and upload it to your server.\n2. Set the correct path and password on [line 22](examples/example.php#L22).\n3. 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)).\n\nAfter completing these steps, you should be ready to go. Upload all the files to your server and navigate to the address\nof the examples/example.php file on your iPhone.\n\n## Debugging\n\n### Using the Console app\n\nIf 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:\n\n![Console with Passkit error](docs/console.png)\n\n- `Trust evaluate failure: [leaf TemporalValidity]`: If you see this error, your pass was signed with an outdated certificate.\n- `Trust evaluate failure: [leaf LeafMarkerOid]`: You did not leave the name of the certificate empty while creating it in the developer portal.\n\n### OpenSSL errors\n\nWhen 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).\n\nThere 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.\n\nInstructions:\n\n1. `openssl pkcs12 -legacy -in key.p12 -nodes -out key_decrypted.tmp` (replace key.p12 with your .p12 file name).\n2. `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)\n\nThe `key_new.p12` file should now be compatible with OpenSSL v3+.\n\n## Changelog\n\n**Version 2.3.2 - September 2024**\n\n- Fix order mime type, add better error reporting.\n\n**Version 2.3.1 - March 2024**\n\n- Chore: add gitattributes.\n\n**Version 2.3.0 - February 2024**\n\n- Add support for Wallet Orders.\n\n**Version 2.2.0 - December 2023**\n\n- Update default WWDR certificate to G4.\n\n**Version 2.1.0 - April 2023**\n\n- Add alternative method for extracting P12 contents to circumvent issues in recent versions of OpenSSL.\n\n**Version 2.0.2 - October 2022**\n\n- Switch to `ZipArchive::OVERWRITE` method of opening ZIP due to PHP 8 deprecation ([#120](https://github.com/includable/php-pkpass/pull/120)).\n\n**Version 2.0.1 - October 2022**\n\n- Update WWDR certificate to v6 ([#118](https://github.com/includable/php-pkpass/issues/118)).\n\n**Version 2.0.0 - September 2022**\n\n- Changed signature of constructor to take out third `$json` parameter.\n- Remove deprecated `setJSON()` method.\n- Removed `checkError()` and `getError()` methods in favor of exceptions.\n\n## Support \u0026 documentation\n\nPlease read the instructions above and consult the [Wallet Documentation](https://developer.apple.com/wallet/) before\nsubmitting tickets or requesting support. It might also be worth\nto [check Stackoverflow](http://stackoverflow.com/search?q=%22PHP-PKPass%22), which contains quite a few questions about\nthis library.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cb\u003e\n\t\t\u003ca href=\"https://includable.com/consultancy/?utm_source=includable/php-pkpass\"\u003eGet professional support for this package →\u003c/a\u003e\n\t\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003csub\u003e\n\t\tCustom consulting sessions available for implementation support and feature development.\n\t\u003c/sub\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschoffelen%2Fphp-pkpass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftschoffelen%2Fphp-pkpass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschoffelen%2Fphp-pkpass/lists"}