eymengunay / php-passbook Goto Github PK
View Code? Open in Web Editor NEWiOS passbook library for PHP
Home Page: http://eymengunay.github.io/php-passbook/
License: MIT License
iOS passbook library for PHP
Home Page: http://eymengunay.github.io/php-passbook/
License: MIT License
Hi!
I am getting the following error:
ErrorException in PassFactory.php line 159:
mkdir(): Permission denied
I have checked that the owner of the folder is the same as executes PHP.
How to fix this?
Hi! thanks for the library! I face a small problem. when i create a pass i can open it from osx, android but when i try to download it from safari i cannot simple import it to ios(9) wallet. The ios promt opens and ask me to choose an app to open the file.
I have check the AppleWWDRCA.pem, i download the file from https connection... , i have try ios simulator is assertion failed: 15A278b 13E230: assertiond
Any idea?
This error was initially reported in PassbookBundle by @Numerah. Moving it here as the bug is caused by this library.
i have generated the passbook application and when i generate passes they are working on every possible device (android ,mac) but IOS 7 iphones and above
when i check iPhone utility manager it was giving me this error: Invalid data error reading pass: The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified. i have my generated certificates and i have seen green sign on the certificates and in my key chain access they are mentioned as verified certificates. there must be a mistake in writing signature or else kindly put some light on this error
Hi !
Thanks for this great project.
One question, how can we set timeStyle and other datetime relative specifiers for a field ?
Brest regards,
Benoit
Hi! Are there any plans for adding pass localization support? Apple reference: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW54
Hi!
Is it possible to use backFields? (Add data to the back side of pass)
I can't find any way to set the expirationDate and the voided boolean into the Pass
Hi,
I'm trying to use your library but i have an issue.
Here is my code:
https://gist.github.com/dator/ff9e8a7bc3acc595fe25
And with this code, i always get "This pass is no longer valid".
My P12 looks fine, the passbook is created but not valid and Qrcode is not displaying.
Do you have an idea ?
Thanks a lot,
I need to be able to add relevant locations to the passbook file. How do you propose I go about doing this?
This is what the JSON will look like
{
...
"description" : "Example pass showing relevance information",
"locations" : [
{"latitude" : 37.3229, "longitude" : -122.0323},
{"latitude" : 37.3286, "longitude" : -122.0143},
{
"altitude" : 10.0,
"latitude" : 37.331,
"longitude" : -122.029,
"relevantText" : "Store nearby on 3rd and Main."
}
],
"relevantDate" : "2014-12-05T09:00-08:00"
}
Hello to all,
I followed the instruction (composer, example, ...)
But when i test my script with phpunit always i get stucked with this error.
`PHP Fatal error: Uncaught Error: Class 'Passbook\Type\EventTicket' not found in /var/www/html/webapp/passbook.php:25
Stack trace:
#0 /usr/share/php/PHPUnit/Util/Fileloader.php(56): include_once()
#1 /usr/share/php/PHPUnit/Util/Fileloader.php(38): PHPUnit_Util_Fileloader::load('/var/www/html/w...')
#2 /usr/share/php/PHPUnit/Runner/StandardTestSuiteLoader.php(39): PHPUnit_Util_Fileloader::checkAndLoad('/var/www/html/w...')
#3 /usr/share/php/PHPUnit/Runner/BaseTestRunner.php(124): PHPUnit_Runner_StandardTestSuiteLoader->load('passbook', '/var/www/html/w...')
#4 /usr/share/php/PHPUnit/Runner/BaseTestRunner.php(65): PHPUnit_Runner_BaseTestRunner->loadSuiteClass('passbook', '/var/www/html/w...')
#5 /usr/share/php/PHPUnit/TextUI/Command.php(128): PHPUnit_Runner_BaseTestRunner->getTest('passbook', '/var/www/html/w...', Array)
#6 /usr/share/php/PHPUnit/TextUI/Command.php(106): PHPUnit_TextUI_Command->run(Array, true)
#7 /usr/bin/phpunit(29): PHPUnit_TextUI_Command::main()
#8 {main}
thrown in /var/www/html/webapp/passbook.php on line 25
`
my folder structure is
i think there are problem with composer or autoload, but i can't figure how to solve it! Any suggestion?
Thank you!
Can you consider tagging a new release?
Thanks! :)
Christian.
AFAIK only PNG images are allowed in pkpass files.
I was using this library and I tried to add JPG images but were not showed up. The library should throw an exception if non PNG image is added. Do you agree ? I've already a draft for this I can send a PR
Hi there, the zipped pass contains the full folder structure.
Taking the Line 208 (" $zip->addFile($passDir);" ) out in PassFactory.php makes it better. Do I do sth wrong?
Thanks for the work! Rly great Framework!
I have not managed to use correctly the 'associatedStoreIdentifiers' attribute of the Pass class with current version of the code.
I used this line of code:
$pass->addAssociatedStoreIdentifier(585027354);
The number 85027354 is the adam id of Google Maps.
Thing is that this attribute is not in the list of properties in the toArray() function of the same class, so when the pkpass is created, the associatedStoreIdentifers aren't in the JSON of the pass.
I added two lines in the toArray() function to make it work: after the foreach, i added:
if(count($this->associatedStoreIdentifiers) != 0)
$array['associatedStoreIdentifiers'] = $this->associatedStoreIdentifiers;
And now it works perfectly, i see the GoogleMaps link at the back of the pass.
Not sure if i'm doing it wrong or if there is an issue.
How to create the 'mykey.key'?
did it support ios 7 already?
Hi,
when I add a barcode to the passbook, the json contains a "barcode" key and also a "barcodes" that is an array with the barcode, why?
I need to add a relevant Time and Date on my passes can be displayed on the lock screen. Could you help me please?
Thanks
All works good , but i have 1 issue , when i creating new pkpass, my file have strange srtucture , pkpassname and path folders.
With this structure , mac can't open this passbook
Help me please.
Thanks.
Hi!
Do I need to enroll in the Apple Developer Program to be able to create Passbook / Wallet passes?
Since this morning dev-master disappeared from packagist.
Maybe there was a commit hook problem at 3dda48d commit or packagist was down?
$ ~/bin/composer show eo/passbook --all
name : eo/passbook
descrip. : iOS Passbook for PHP
keywords : mobile, ios, passbook, pass, wallet, coupons, tickets
versions : v1.2.1, v1.2.0, v1.1.3, v1.1.2, v1.1.1, v1.1.0, v1.0.1, v1.0.0
type : library
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source : [git] https://github.com/eymengunay/php-passbook.git 7f7be28fa637fdddd122f7d9124443c46e9bf46e
dist : [zip] https://api.github.com/repos/eymengunay/php-passbook/zipball/7f7be28fa637fdddd122f7d9124443c46e9bf46e 7f7be28fa637fdddd122f7d9124443c46e9bf46e
names : eo/passbook
autoload
psr-0
Passbook\ => src/
requires
php >=5.3.6
ext-zip *
ext-openssl *
requires (dev)
phpunit/phpunit 3.7.*
Dumb question, might be... but is it possible just to user php-passbook without composer?
I would like to use it in my backend.
When including and testing around I keep getting the error;
Fatal error: Class 'Passbook\Type\EventTicket' not found...
In Pass.php file Line 156, key name for webservice URL is
* @SerializedName(value="webServiceUrl")
However the correct name should be webServiceURL , URL is capitalised! It really drive me crazy for a few days:)
Would be great with a usage example to create, say a Ticket. From generation to outputting to user.
Hello,
as you've added composer support in 0dc19c2, you defined the autoload as
"autoload": {
"psr-0": { "PHP-Passbook\\": "src/" }
}
According to the documentation, I believe that would register everything under src
into PHP-Passbook
namespace (http://getcomposer.org/doc/01-basic-usage.md#autoloading). However, that is neither a valid namespace name nor actually the namespace declared in Passbook.php
.
Could you please either change the namespace in both the manifest and the library or autoload using
"autoload": {
"files": ["src/Passbook.php"]
}
Thanks
ps or just decide what you like more, I'll send the pull request
i was facing this error from the beginning of my development and it generates the folder instead of .pkpass file and didnt sign the pass. initially it looked like openssl problem. after 3 months i finally found the solution its the PHP_EOL content which is causing problem in windows. kindly remove it as there is no need of this in signature but decoration . i remove this end of line content and it is working perfectly fine on my windows. but when i will update my project packages it will overwrite automatically. kindly resolve this or tell us any alternative in windows.
it lies
https://github.com/eymengunay/php-passbook/blob/master/src/Passbook/PassFactory.php
in line 201 and 202
I don't see any key which is paired with iphone developer certificate.
Can I get it from any other way?
Is that Pass type certificate or iphone developer certificate?
Hi, I get this error, someone can help me? what could be the problem?
For the p12 certificate, I have use the production certificate of the Pass Type ID, on the read me of the project instead, it's write to use the iPhone Developer Certificate, what I have to use?
Given this:
use Passbook\Pass\Localization;
$localization = new Localization('en');
$localization->addStrings([
'SOME_FIELD' => 'This "has" "quotes"',
]);
...the expected en.lproj/pass.strings
is supposed to have this line:
"SOME_FIELD" = "This \"has \"quotes\"";
...yet the quotes are ignored and the pass.strings
file gets malformed, which, in turn, makes a part of the translations invalid:
"SOME_FIELD" = "This "has "quotes"";
"SOME_OTHER_FIELD"="Test test";
If I had some of the fields after this faulty one, those would be broken too. I suggest adding an addslashes()
call somewhere, for example in the Localization#getStringsFileOutput()
method.
Hi,
I'm trying to use your php-passbook library but I keep having the error :
Fatal error: Call to undefined method Passbook\Pass\Image::getExtension() in /var/www/XXXPassbook/PassFactory.php on line 173
while calling "$factory->package( $pass );"
I tried using the sample code on the homepage.
getStructure within the Pass class is attempting to reference $this->$structure which $structure is not defined within the function.
i m new in development
i install passbook library in cakephp using composer
i add the example code in passbook.php file in src/Passbook folder and include the file in my controller
< ? p h p
require '../../autoload.php';
use Passbook\Pass\Field;
use Passbook\Pass\Image;
use #Passbook\PassFactory;
use Passbook\Pass\Barcode;
use Passbook\Pass\Structure;
use Passbook\Type\EventTicket;
// Set these constants with your values

define('P12_FILE', '/cer/HTViOSPassKitP12File.p12');
define('P12_PASSWORD', '123456789');
define('WWDR_FILE', '/cer/wdrc.pem');
define('PASS_TYPE_IDENTIFIER', 'pass.com.htvi.os');
define('TEAM_IDENTIFIER', '26V2Q4KMYM');
define('ORGANIZATION_NAME', 'NEWSPAPER AGENCY COMPANY LLC');
define('OUTPUT_PATH', '/cer/coupon');
define('ICON_FILE', '/cer/book.png');
here is the passbook.php code
when i run the function it show
page isn’t working
HTTP ERROR 500
please help me
$logo = new Image(LOGO_FILE, 'logo');
$pass->addImage($logo);
hello, reaally need your help
i am adding a logo image as above as you suggested in example and the pass can not be read in applewallet anymore since upgraded to v.2.0
not really sure what am I doing wrong
if i skipp adding logo and just add an icon image passcode ia working just fine in v 2.0
PassFactory has dependencies that rely on functionality that is not required for the project. Not everybody uses Symphony for their framework, or composure, for their projects. Composure not a big deal, but if third party libraries are going to referenced, they should be included in the project. Same goes for references to JMS\Serializer.
HI!
The pkpass file doesn't work at iphone devices. When the file is downloaded by Safary, it is showed this error: "Safari cannot download this file". I am testing with simulator of xcode and show the next logs:
Jun 23 18:06:41 iMac MobileSafari[646]: BOM could not extract archive: Couldn't read PKZip signature
Jun 23 18:06:41 --- last message repeated 1 time ---
Jun 23 18:06:41 iMac MobileSafari[646]: PassBook Pass download failed: The pass cannot be read because it isn’t valid.
I have generated the p12 file like you say at https://github.com/eymengunay/php-passbook#p12-certificate.
Finally, I can install the pkpass at Android devices.
I hope that you can help me.
Thank you!
Hi,
I can add the Passbook on iOS, but when I'm trying to add it on an Android App like Pass2U the Passbook is black I can see only the barcode, instead if I open it on another Android app like PassWallet give me an error that can't open it. There a fix? someone know this problem?
Hey, just wanted to let you know that i found an issue for windows.
PassFactory seems to have a problem in the zip() function at Line 362 where the slashes for UNIX are brought in the right direction. But for Windows this causes an issue.
So i added $file = str_replace('', '/', $file); directly after this line, to solve this issue.
Im not sure how to add a pull request. So this is how im letting you know.
Apple docs say that all PNG assets in a pass can now include 3x versions alongside the 2x.
It would be good if the library could support adding these assets to the pass (maybe replace isRetina
in the Image
class with a density
property which equals 1, 2 or 3)
i Tried like hell to find how to set transit for boarding pass . i am almost done with my complete pass generation of any type i.e. Coupon ,Generic,Store Card,Boarding Pass, Event Ticket. almost set every property of every coupon. i saw this code in Boarding pass type
protected $transitType;
/**
/**
/**
/**
/**
/**
public function toArray()
{
$array = parent::toArray();
$array['transitType'] = $this->transitType;
return $array;
}
and i tried to set the pass configurations like every other
$pass = new BoardingPass("12345", "Template Name",'PKTransitTypeAir');
i also tried this
$pass = new BoardingPass("12345",'PKTransitTypeAir', "Template Name");
but no transit appear in my generated pass.
Hi,
If I add a relevantDate for an event ticket, I can see it at the relevantDate in the lock screen, but remain there and doesn't go away, the only way to remove it from the lock screen is to remove the passbook from the Wallet or uncheck the lock screen option for that passbook. Anyone knows if there is an expiry date and remove it automatically?
I am having trouble adding a line break on the BackField. I have tried \r\n and \n but this is included in the pass as text. I saw in the Apple documentation that they were using \n. Do you handle that different?
Hi.
I trying to run the passbook sample demo, and I don't have problems to generate the .pkpass file... but I can't open it in iOS 8.3...
A question... Have I to export the Private Key of iPhone Development Cert, or the iPhone Distribution Cert?
And the TEAM, is the TEAM of Distribution, or the Development?
Now, I'm using the .P12 of the Private Key of the iPhone Distribution Cert, and the same for the TEAM ID (Distribution Cert).
Anybody can help me?
Thanks!
We have noticed that generating a StoreCard using NumberField to inform the amount does not show anything if you set the curredncy code (NumberField::setCurrencyCode())
In order to solving this issue we had to override this function forcing an integer casting return:
/**
* @return int
*/
public function getValue()
{
return (int)parent::getValue();
}
In the Pass class, i can't set the max distance. I don't understand why max distance needs to be DateTime.
Thanks.
/**
* {@inheritdoc}
*/
public function setMaxDistance(\DateTime $maxDistance)
{
$this->maxDistance = $maxDistance;
return $this;
}
feature request :)
add imgs in folder to structure in online code , no for/while
Also current Image class seems did not handle @2x images.
PHP 5.4.24 Cli
Using the Usage Example
for testing,
signpass -v verify the signature, but pkpass cannot add into passbook(iOS7.0.4),
and I found outputpath/passsn/. in the zip file...
the unpacked tree is like this (114567890 is the pass serialNumber)
├── manifest.json
├── output
│ └── 114567890 (folder as well)
├── pass.json
└── signature
Could not find why.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.