承接 laulamanapps/apple-passbook 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laulamanapps/apple-passbook

最新稳定版本:v1.1.4

Composer 安装命令:

composer require laulamanapps/apple-passbook

包简介

Generate Apple Passbooks from PHP

README 文档

README

This package provides a simple OOP integration of the Apple Passbook API for your PHP project.

GithubCi Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version License

Installation

With composer, add:

$ composer require laulamanapps/apple-passbook

Or if your using Symfony install laulamanapps/apple-passbook-bundle:

$ composer require laulamanapps/apple-passbook-bundle

Run Tests

We use act to run tests which runs github actions locally:

$ act -P ubuntu-latest=shivammathur/node:latest

Get certificate

Head over to the Apple Developer Portal to get yourself a certificate to sign your passbooks with.

Convert the certificate and key to a .p12 file using the Keychain Access

Setup Compiler

use LauLamanApps\ApplePassbook\Build\CompilerFactory;

$factory = new CompilerFactory();
$compiler = $factory->getCompiler('<PathToCertificate>', '<CertificatePassword>');

AppleWWDRA certificate.

Included ar 2 AppleWWDRCA certificates:

  • AppleWWDRCA.pem - Expires feb 3 2023
  • AppleWWDRCAG3.pem - Expires feb 20 2030

By default AppleWWDRCA is used if you want to use the otherone you can do so by setting its file path as the 3rd option in the CompilerFactory or calling setAppleWWDRCA() on the Signer class for custom implementation

Create Passbook

use LauLamanApps\ApplePassbook\EventTicketPassbook;
use LauLamanApps\ApplePassbook\MetaData\Barcode;
use LauLamanApps\ApplePassbook\MetaData\Field\Field;
use LauLamanApps\ApplePassbook\MetaData\Image\LocalImage;
use LauLamanApps\ApplePassbook\MetaData\Location;
use LauLamanApps\ApplePassbook\Style\BarcodeFormat;
use LauLamanApps\ApplePassbook\Style\Color\Rgb;

$passbook = new EventTicketPassbook('nmyuxofgna');
$passbook->setTeamIdentifier('<TeamId>');
$passbook->setPassTypeIdentifier('<PassTypeId>');
$passbook->setOrganizationName('Apple Inc.');
$passbook->setDescription('Apple Event Ticket');
$passbook->setRelevantDate(new DateTimeImmutable('2011-12-08T13:00-08:00'));
$passbook->setForegroundColor(new Rgb(255, 255, 255));
$passbook->setBackgroundColor(new Rgb(60, 65, 76));
$passbook->setWebService('https://example.com/passes/', 'vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc');

$passbook->addLocation(new Location(37.6189722, -122.3748889));
$passbook->addLocation(new Location(37.33182, -122.03118));

$barcode = new Barcode();
$barcode->setFormat(BarcodeFormat::pdf417());
$barcode->setMessage('123456789');
$passbook->setBarcode($barcode);

$event = new Field();
$event->setKey('event');
$event->setLabel('EVENT');
$event->setValue('The Beat Goes On');
$passbook->addPrimaryField($event);

$loc = new Field();
$loc->setKey('loc');
$loc->setLabel('LOCATION');
$loc->setValue('Moscone West');
$passbook->addSecondaryField($loc);

$passbook->addImage(new LocalImage('/files/Event/background.png'));
$passbook->addImage(new LocalImage('/files/Event/icon.png'));
$passbook->addImage(new LocalImage('/files/Event/logo.png'));
$passbook->addImage(new LocalImage('/files/Event/thumbnail.png'));

Compile Passbook

header('Content-Description: File Transfer');
header('Content-Type: application/vnd.apple.pkpass');
header('Content-Disposition: filename="boardingpass.pkpass"');

echo $compiler->compile($passbook);

Examples

For the examples to work place the certificate P12 file in the /certificates folder and fill out the required information in the example scripts: <CertificatePassword>, <TeamId>, <PassTypeId>

Example php scripts can be found in docs/example:

Credits

This package has been developed by LauLaman.

统计信息

  • 总下载量: 141.51k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固