├── README.md ├── certs ├── .htaccess ├── AppleWWDRCA.pem ├── Certificate.p12 └── readme.txt ├── data ├── array.php ├── coupon.json ├── event.json ├── event.php ├── generic.json ├── json.php ├── readme.txt ├── small.json └── small.php ├── geo.php ├── images ├── icon.png ├── icon@2x.png ├── logo.png └── readme.txt ├── index.php ├── passes ├── array.php.pkpass ├── coupon.json.pkpass ├── event.json.pkpass ├── generic.json.pkpass ├── json.php.pkpass ├── small.json.pkpass └── small.php.pkpass └── passkit.php /README.md: -------------------------------------------------------------------------------- 1 | # passkit.php 2 | ## a php function to create passes for Apple Passbook 3 | 4 | [](http://unmaintained.tech/) 5 | [](https://flattr.com/submit/auto?user_id=SimonWaldherr&url=http%3A%2F%2Fgithub.com%2FSimonWaldherr%2Fpasskit.php "Donate monthly to this project using Flattr") 6 | [](https://www.paypal.me/SimonWaldherr "Donate to this project via PayPal.me") 7 | 8 | ***if you tested/used the code recently, please feel free to add your configuration to the ```Tested with``` paragraph below*** 9 | 10 | ### Info material 11 | 12 | * [Passbook Programming Guide](https://developer.apple.com/library/prerelease/ios/#documentation/UserExperience/Conceptual/PassKit_PG/) 13 | * [Downloads from developer.apple.com](https://developer.apple.com/downloads/index.action?name=Passbook) 14 | * [developer.apple.com Provisioning Portal](https://developer.apple.com/ios/manage/passtypeids/ios/manage) 15 | 16 | ### Requirements 17 | 18 | * Clientside 19 | * iOS > 6.0.0 20 | * Mac OS X > 10.8.0 21 | * Serverside 22 | * PHP 5 >= 5.2.2 23 | * Access to filesystem 24 | * Other 25 | * [iOS Developer Account](https://developer.apple.com/devcenter/ios/index.action) (99$/Year) 26 | 27 | ### Tested with 28 | 29 | * Clienthardware 30 | * iPhone 4 31 | * iPhone 4s 32 | * iPhone 5s 33 | * iPod Touch (4.Gen.) 34 | * iMac 35 | * MBP 36 | * Clientsoftware 37 | * iOS 6.x 38 | * iOS 7.0 39 | * iOS 7.0.3 40 | * iOS 7.1 41 | * Mac OS X 10.8 42 | * Mac OS X 10.9 43 | * Serversoftware 44 | * Linux (RHEL 5) 45 | * Linux (Debian 7) 46 | * Solaris (11.1) 47 | * Apache 2 48 | * PHP 5.3.13 49 | * PHP 5.4.4 50 | * PHP 5.5.5 51 | 52 | ### License 53 | 54 | The MIT License 55 | Copyright © 2014 Simon Waldherr 56 | 57 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 58 | 59 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 60 | 61 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 62 | 63 | ### Version 64 | 65 | passkit.php v1.0 66 | 67 | ### Howto 68 | 69 | In order to get it working on your server, you have to: 70 | * replace the dummy ```Certificate.p12``` with your own cert 71 | * change the teamIdentifier in ```/data/XYZ.json``` to your own 72 | * change the passTypeIdentifier in ```/data/XYZ.json``` to your own 73 | * select a temp directory in ```index.php``` 74 | * upload to your server 75 | * change permissions of your temp dir ```chmod``` 76 | 77 | more details coming soon ... 78 | 79 | ### Questions 80 | 81 | feel free to ask via: 82 | 83 | * GitHub ([via Issues](https://github.com/SimonWaldherr/passkit.php/issues)) 84 | * contact form ([on my page](http://simon.waldherr.eu/)) 85 | * [eMail](mailto:contact@simonwaldherr.de) 86 | * Twitter [@SimonWaldherr](http://twitter.com/simonwaldherr) 87 | -------------------------------------------------------------------------------- /certs/.htaccess: -------------------------------------------------------------------------------- 1 | Order deny,allow 2 | Deny from all -------------------------------------------------------------------------------- /certs/AppleWWDRCA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEIzCCAwugAwIBAgIBGTANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQGEwJVUzET 3 | MBEGA1UEChMKQXBwbGUgSW5jLjEmMCQGA1UECxMdQXBwbGUgQ2VydGlmaWNhdGlv 4 | biBBdXRob3JpdHkxFjAUBgNVBAMTDUFwcGxlIFJvb3QgQ0EwHhcNMDgwMjE0MTg1 5 | NjM1WhcNMTYwMjE0MTg1NjM1WjCBljELMAkGA1UEBhMCVVMxEzARBgNVBAoMCkFw 6 | cGxlIEluYy4xLDAqBgNVBAsMI0FwcGxlIFdvcmxkd2lkZSBEZXZlbG9wZXIgUmVs 7 | YXRpb25zMUQwQgYDVQQDDDtBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0 8 | aW9ucyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQAD 9 | ggEPADCCAQoCggEBAMo4VKbLVqrIJDlI6Yzu7F+4fyaRvDRTes58Y4Bhd2RepQcj 10 | tjn+UC0VVlhwLX7EbsFKhT4v8N6EGqFXya97GP9q+hUSSRUIGayq2yoy7ZZjaFIV 11 | PYyK7L9rGJXgA6wBfZcFZ84OhZU3au0Jtq5nzVFkn8Zc0bxXbmc1gHY2pIeBbjiP 12 | 2CsVTnsl2Fq/ToPBjdKT1RpxtWCcnTNOVfkSWAyGuBYNweV3RY1QSLorLeSUheHo 13 | xJ3GaKWwo/xnfnC6AllLd0KRObn1zeFM78A7SIym5SFd/Wpqu6cWNWDS5q3zRinJ 14 | 6MOL6XnAamFnFbLw/eVovGJfbs+Z3e8bY/6SZasCAwEAAaOBrjCBqzAOBgNVHQ8B 15 | Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUiCcXCam2GGCL7Ou6 16 | 9kdZxVJUo7cwHwYDVR0jBBgwFoAUK9BpR5R2Cf70a40uQKb3R01/CF4wNgYDVR0f 17 | BC8wLTAroCmgJ4YlaHR0cDovL3d3dy5hcHBsZS5jb20vYXBwbGVjYS9yb290LmNy 18 | bDAQBgoqhkiG92NkBgIBBAIFADANBgkqhkiG9w0BAQUFAAOCAQEA2jIAlsVUlNM7 19 | gjdmfS5o1cPGuMsmjEiQzxMkakaOY9Tw0BMG3djEwTcV8jMTOSYtzi5VQOMLA6/6 20 | EsLnDSG41YDPrCgvzi2zTq+GGQTG6VDdTClHECP8bLsbmGtIieFbnd5G2zWFNe8+ 21 | 0OJYSzj07XVaH1xwHVY5EuXhDRHkiSUGvdW0FY5e0FmXkOlLgeLfGK9EdB4ZoDpH 22 | zJEdOusjWv6lLZf3e7vWh0ZChetSPSayY6i0scqP9Mzis8hH4L+aWYP62phTKoL1 23 | fGUuldkzXfXtZcwxN8VaBOhr4eeIA0p1npsoy0pAiGVDdd3LOiUjxZ5X+C7O0qmS 24 | XnMuLyV1FQ== 25 | -----END CERTIFICATE----- 26 | -------------------------------------------------------------------------------- /certs/Certificate.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/certs/Certificate.p12 -------------------------------------------------------------------------------- /certs/readme.txt: -------------------------------------------------------------------------------- 1 | In order to function correctly, you must replace the file Certificate.p12 with your own. 2 | You can configure and download your own Certificate in the Apple Provisioning Portal: 3 | https://developer.apple.com/ios/manage/passtypeids/ios/manage //you need a dev Account! 4 | -------------------------------------------------------------------------------- /data/array.php: -------------------------------------------------------------------------------- 1 | "origin", 5 | "label" => "San Francisco", 6 | "value" => "SFO"), 7 | array("key" => "destination", 8 | "label" => "London", 9 | "value" => "LHR")); 10 | 11 | $secondaryFields = new ArrayObject(); 12 | $secondaryFields = array(array("key" => "gate", 13 | "label" => "Gate", 14 | "value" => "F12"), 15 | array("key" => "date", 16 | "label" => "Departure date", 17 | "value" => "07/11/2012 ".rand(0,23).':'.rand(0,59))); 18 | 19 | $backFields = new ArrayObject(); 20 | $backFields = array(array("key" => "passenger-name", 21 | "label" => "Passenger", 22 | "value" => "John Appleseed")); 23 | 24 | $JSON = json_encode(array("passTypeIdentifier" => "pass.com.apple.demo", 25 | "formatVersion" => 1, 26 | "organizationName" => "Apple Inc", 27 | "serialNumber" => "123456", 28 | "teamIdentifier" => "123ABCDEFG", 29 | "backgroundColor" => "rgb(107,156,196)", 30 | "logoText" => "Flight info", 31 | "description" => "passkit.php demo pass", 32 | "boardingPass" => array("primaryFields" => $primaryFields, 33 | "secondaryFields" => $secondaryFields, 34 | "backFields" => $backFields, 35 | "transitType" => "PKTransitTypeAir"), 36 | "barcode" => array("format" => "PKBarcodeFormatQR", 37 | "message" => "Flight-GateF12-ID6643679AH7B", 38 | "messageEncoding" => "utf-8"))); 39 | 40 | ?> -------------------------------------------------------------------------------- /data/coupon.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", 3 | "backgroundColor": "rgb(206, 140, 53)", 4 | "barcode": { 5 | "format": "PKBarcodeFormatPDF417", 6 | "message": "123456789", 7 | "messageEncoding": "iso-8859-1" 8 | }, 9 | "coupon": { 10 | "auxiliaryFields": [ 11 | { 12 | "key": "expires", 13 | "label": "EXPIRES", 14 | "value": "2 weeks" 15 | } 16 | ], 17 | "backFields": [ 18 | { 19 | "key": "terms", 20 | "label": "TERMS AND CONDITIONS", 21 | "value": "Generico offers this pass, including all information, software, products and services available from this pass or offered as part of or in conjunction with this pass (the \"pass\"), to you, the user, conditioned upon your acceptance of all of the terms, conditions, policies and notices stated here. Generico reserves the right to make changes to these Terms and Conditions immediately by posting the changed Terms and Conditions in this location.\n\nUse the pass at your own risk. This pass is provided to you \"as is,\" without warranty of any kind either express or implied. Neither Generico nor its employees, agents, third-party information providers, merchants, licensors or the like warrant that the pass or its operation will be accurate, reliable, uninterrupted or error-free. No agent or representative has the authority to create any warranty regarding the pass on behalf of Generico. Generico reserves the right to change or discontinue at any time any aspect or feature of the pass." 22 | } 23 | ], 24 | "primaryFields": [ 25 | { 26 | "key": "offer", 27 | "label": "Any premium dog food", 28 | "value": "20% off" 29 | } 30 | ] 31 | }, 32 | "description": "20% off premium dog food", 33 | "foregroundColor": "rgb(255, 255, 255)", 34 | "formatVersion": 1, 35 | "locations": [ 36 | { 37 | "latitude": 37.6189722, 38 | "longitude": -122.3748889 39 | }, 40 | { 41 | "latitude": 37.33182, 42 | "longitude": -122.03118 43 | } 44 | ], 45 | "logoText": "Paw Planet", 46 | "organizationName": "Paw Planet", 47 | "passTypeIdentifier": "pass.com.apple.demo", 48 | "serialNumber": "E5982H-I2", 49 | "teamIdentifier": "123ABCDEFG", 50 | "webServiceURL": "https://example.tld/pass" 51 | } -------------------------------------------------------------------------------- /data/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", 3 | "backgroundColor": "rgb(60, 65, 76)", 4 | "barcode": { 5 | "format": "PKBarcodeFormatPDF417", 6 | "message": "123456789", 7 | "messageEncoding": "iso-8859-1" 8 | }, 9 | "description": "The Beat Goes On", 10 | "eventTicket": { 11 | "backFields": [ 12 | { 13 | "key": "terms", 14 | "label": "TERMS AND CONDITIONS", 15 | "value": "Generico offers this pass, including all information, software, products and services available from this pass or offered as part of or in conjunction with this pass (the \"pass\"), to you, the user, conditioned upon your acceptance of all of the terms, conditions, policies and notices stated here. Generico reserves the right to make changes to these Terms and Conditions immediately by posting the changed Terms and Conditions in this location.\n\nUse the pass at your own risk. This pass is provided to you \"as is,\" without warranty of any kind either express or implied. Neither Generico nor its employees, agents, third-party information providers, merchants, licnsors or the like warrant that the pass or its operation will be accurate, reliable, uninterrupted or error-free. No agent or representative has the authority to create any warranty regarding the pass on behalf of Generico. Generico reserves the right to change or discontinue at any time any aspect or feature of the pass." 16 | } 17 | ], 18 | "primaryFields": [ 19 | { 20 | "key": "event", 21 | "label": "EVENT", 22 | "value": "The Beat Goes On" 23 | } 24 | ], 25 | "secondaryFields": [ 26 | { 27 | "key": "loc", 28 | "label": "LOCATION", 29 | "value": "Moscone West" 30 | } 31 | ] 32 | }, 33 | "foregroundColor": "rgb(255, 255, 255)", 34 | "formatVersion": 1, 35 | "locations": [ 36 | { 37 | "latitude": 37.6189722, 38 | "longitude": -122.3748889 39 | }, 40 | { 41 | "latitude": 37.33182, 42 | "longitude": -122.03118 43 | } 44 | ], 45 | "organizationName": "Apple Inc.", 46 | "passTypeIdentifier": "pass.com.apple.demo", 47 | "relevantDate": "2011-12-08T13:00-08:00", 48 | "serialNumber": "nmyuxofgnb", 49 | "teamIdentifier": "123ABCDEFG", 50 | "webServiceURL": "https://example.tld/pass" 51 | } -------------------------------------------------------------------------------- /data/event.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/generic.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", 3 | "backgroundColor": "rgb(197, 31, 31)", 4 | "barcode": { 5 | "format": "PKBarcodeFormatPDF417", 6 | "message": "123456789", 7 | "messageEncoding": "iso-8859-1" 8 | }, 9 | "description": "Membership card", 10 | "foregroundColor": "rgb(255, 255, 255)", 11 | "formatVersion": 1, 12 | "generic": { 13 | "auxiliaryFields": [ 14 | { 15 | "key": "level", 16 | "label": "LEVEL", 17 | "value": "Platinum" 18 | }, 19 | { 20 | "key": "favorite", 21 | "label": "FAVORITE TOY", 22 | "textAlignment": "PKTextAlignmentRight", 23 | "value": "Trucks" 24 | } 25 | ], 26 | "backFields": [ 27 | { 28 | "key": "numberStyle", 29 | "label": "spelled out", 30 | "numberStyle": "PKNumberStyleSpellOut", 31 | "value": 200 32 | }, 33 | { 34 | "key": "loc", 35 | "label": "localized to french", 36 | "value": "Oh my stars." 37 | }, 38 | { 39 | "currencyCode": "BRL", 40 | "key": "currency", 41 | "label": "in reals", 42 | "value": 200 43 | }, 44 | { 45 | "dateStyle": "PKDateStyleFull", 46 | "key": "dateFull", 47 | "label": "date full", 48 | "value": "1980-05-07T10:00-05:00" 49 | }, 50 | { 51 | "key": "timeFull", 52 | "label": "time full", 53 | "timeStyle": "PKDateStyleFull", 54 | "value": "1980-05-07T10:00-05:00" 55 | }, 56 | { 57 | "dateStyle": "PKDateStyleShort", 58 | "key": "dateTime", 59 | "label": "dateTime", 60 | "timeStyle": "PKDateStyleShort", 61 | "value": "1980-05-07T10:00-05:00" 62 | }, 63 | { 64 | "dateStyle": "PKDateStyleShort", 65 | "isRelative": true, 66 | "key": "relStyle", 67 | "label": "rel style", 68 | "value": "2012-04-24T10:00-05:00" 69 | } 70 | ], 71 | "primaryFields": [ 72 | { 73 | "key": "member", 74 | "value": "Johnny Appleseed" 75 | } 76 | ], 77 | "secondaryFields": [ 78 | { 79 | "key": "subtitle", 80 | "label": "MEMBER SINCE", 81 | "value": "2012" 82 | } 83 | ] 84 | }, 85 | "locations": [ 86 | { 87 | "latitude": 37.6189722, 88 | "longitude": -122.3748889 89 | }, 90 | { 91 | "latitude": 37.33182, 92 | "longitude": -122.03118 93 | } 94 | ], 95 | "logoText": "Toy Town", 96 | "organizationName": "Apple Inc", 97 | "passTypeIdentifier": "pass.com.apple.demo", 98 | "serialNumber": "8j23fm3", 99 | "teamIdentifier": "123ABCDEFG", 100 | "webServiceURL": "https://example.tld/pass" 101 | } -------------------------------------------------------------------------------- /data/json.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/readme.txt: -------------------------------------------------------------------------------- 1 | the files in this dir are only examples, please read the passbook programming guide at developer.apple.com 2 | https://developer.apple.com/library/prerelease/ios/#documentation/UserExperience/Conceptual/PassKit_PG/ 3 | and download the example files from Apple: 4 | https://developer.apple.com/downloads/index.action?name=Passbook 5 | -------------------------------------------------------------------------------- /data/small.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc", 3 | "backgroundColor": "rgb(42, 147, 51)", 4 | "barcode": { 5 | "format": "PKBarcodeFormatQR", 6 | "message": "https://github.com/SimonWaldherr/passkit.php", 7 | "messageEncoding": "utf-8" 8 | }, 9 | "description": "Demo Pass", 10 | "foregroundColor": "rgb(251, 251, 251)", 11 | "formatVersion": 1, 12 | "generic": { 13 | "primaryFields": [ 14 | { 15 | "key": "url", 16 | "value": "github.com/SimonWaldherr/passkit.php" 17 | } 18 | ] 19 | }, 20 | "logoText": "passkit.php", 21 | "organizationName": "Apple Inc", 22 | "passTypeIdentifier": "pass.com.apple.demo", 23 | "serialNumber": "8j23fm3", 24 | "teamIdentifier": "123ABCDEFG" 25 | } -------------------------------------------------------------------------------- /data/small.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /geo.php: -------------------------------------------------------------------------------- 1 | './certs/AppleWWDRCA.pem', 8 | 'Certificate' => './certs/Certificate.p12', 9 | 'CertPassword' => 'THE PASSWORD FOR YOUR CERTIFICATE'); 10 | 11 | $ImageFiles = array('images/icon.png', 'images/icon@2x.png', 'images/logo.png'); 12 | 13 | include('./data/event.php'); 14 | 15 | $TempPath = '/pages/home/htdocs/temp/'; 16 | 17 | echoPass(createPass($Certificates, $ImageFiles, $JSON, 'passtest', $TempPath)); 18 | 19 | m_uwait(12500); 20 | die(); 21 | } 22 | 23 | ?> 24 |
25 | 26 | 27 | 28 |this is a passkit.php demo with geo information
58 | 59 | 65 |the source of this software ist available at GitHub in the github.com/SimonWaldherr/passkit.php repository.
66 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/images/icon.png -------------------------------------------------------------------------------- /images/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/images/icon@2x.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/images/logo.png -------------------------------------------------------------------------------- /images/readme.txt: -------------------------------------------------------------------------------- 1 | In addition to the data, a passbook pass also includes images. 2 | At least there habe to be the pictures icon.png, icon@2x.png and logo.png. 3 | The following images will be recognized by the iOS6 Passbook App: 4 | background.png 5 | background@2x.png 6 | icon.png 7 | icon@2x.png 8 | logo.png 9 | logo@2x.png 10 | strip.png 11 | strip@2x.png 12 | thumbnail.png 13 | thumbnail@2x.png 14 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | './certs/AppleWWDRCA.pem', 13 | 'Certificate' => './certs/Certificate.p12', 14 | 'CertPassword' => 'THE PASSWORD FOR YOUR CERTIFICATE'); 15 | 16 | 17 | $ImageFiles = array('images/icon.png', 'images/icon@2x.png', 'images/logo.png'); 18 | 19 | $data = array('./data/array.php', 20 | './data/json.php', 21 | './data/small.php', 22 | './data/coupon.json', 23 | './data/event.json', 24 | './data/small.json', 25 | './data/generic.json'); 26 | if($_GET['update'] != '') 27 | { 28 | $example_data = 4; 29 | } 30 | elseif(!is_numeric($_POST['aexample'])) 31 | { 32 | $example_data = rand(0,6); 33 | } 34 | else 35 | { 36 | $example_data = $_POST['aexample']; 37 | } 38 | 39 | 40 | if($example_data < 3) 41 | { 42 | include($data[$example_data]); 43 | } 44 | else 45 | { 46 | $JSON = file_get_contents($data[$example_data]); 47 | } 48 | 49 | 50 | $TempPath = '/pages/home/htdocs/temp/'; 51 | 52 | echoPass(createPass($Certificates, $ImageFiles, $JSON, 'passtest', $TempPath)); 53 | 54 | m_uwait(12500); 55 | die(); 56 | } 57 | 58 | ?> 59 | 60 | 61 | 62 | 63 |select a example and press the submit button to generate a pass
93 | 107 |if you like this demo, please try the GEO Example, too.
108 |the source of this software ist available at GitHub in the github.com/SimonWaldherr/passkit.php repository.
109 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /passes/array.php.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/array.php.pkpass -------------------------------------------------------------------------------- /passes/coupon.json.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/coupon.json.pkpass -------------------------------------------------------------------------------- /passes/event.json.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/event.json.pkpass -------------------------------------------------------------------------------- /passes/generic.json.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/generic.json.pkpass -------------------------------------------------------------------------------- /passes/json.php.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/json.php.pkpass -------------------------------------------------------------------------------- /passes/small.json.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/small.json.pkpass -------------------------------------------------------------------------------- /passes/small.php.pkpass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonWaldherr/passkit.php/c8dab6e763ca8afb3d9949a293b8c5114ad07db7/passes/small.php.pkpass -------------------------------------------------------------------------------- /passkit.php: -------------------------------------------------------------------------------- 1 | open($PKPassPath, ZIPARCHIVE::CREATE); 49 | $ZIP->addFromString('signature', $ManifestSignatureDER); 50 | $ZIP->addFromString('manifest.json', $Manifest); 51 | $ZIP->addFromString('pass.json', $JSON); 52 | foreach($ImageFiles as $ImagePath) 53 | { 54 | $ImageName = basename($ImagePath); 55 | $ZIP->addFile($ImagePath, $ImageName); 56 | } 57 | $ZIP->close(); 58 | 59 | //load pass data und delete temp files (if debug mode is off) 60 | $Pass['data'] = file_get_contents($PKPassPath); 61 | $Pass['size'] = filesize($PKPassPath); 62 | $Pass['name'] = $PassName; 63 | if(!$Debug) 64 | { 65 | unlink($TempPath.$UniquePassId.'/manifest.json'); 66 | unlink($TempPath.$UniquePassId.'/'.$PassName.'.pkpass'); 67 | unlink($TempPath.$UniquePassId.'/signature'); 68 | rmdir($TempPath.$UniquePassId); 69 | } 70 | 71 | return $Pass; 72 | } 73 | 74 | function echoPass($Pass) 75 | { 76 | //send http headers and zip archive content to client 77 | header('Pragma: no-cache'); 78 | header('Content-type: application/vnd.apple.pkpass'); 79 | header('Content-length: '.$Pass['size']); 80 | header('Content-Disposition: attachment; filename="'.$Pass['name'].'.pkpass"'); 81 | echo $Pass['data']; 82 | } 83 | 84 | ?> 85 | --------------------------------------------------------------------------------