1. Go to this page and download the library: Download eo/passbook library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eo / passbook example snippets
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', '/path/to/p12/certificate.p12');
define('P12_PASSWORD', 'password_for_p12_file');
define('WWDR_FILE', '/path/to/wwdr.pem');
define('PASS_TYPE_IDENTIFIER', 'pass.com.example.yourpass');
define('TEAM_IDENTIFIER', 'IDFROMAPPLE');
define('ORGANIZATION_NAME', 'Your Organization Name');
define('OUTPUT_PATH', '/path/to/output/path');
define('ICON_FILE', '/path/to/icon.png');
// Create an event ticket
$pass = new EventTicket("1234567890", "The Beat Goes On");
$pass->setBackgroundColor('rgb(60, 65, 76)');
$pass->setLogoText('Apple Inc.');
// Create pass structure
$structure = new Structure();
// Add primary field
$primary = new Field('event', 'The Beat Goes On');
$primary->setLabel('Event');
$structure->addPrimaryField($primary);
// Add secondary field
$secondary = new Field('location', 'Moscone West');
$secondary->setLabel('Location');
$structure->addSecondaryField($secondary);
// Add auxiliary field
$auxiliary = new Field('datetime', '2013-04-15 @10:25');
$auxiliary->setLabel('Date & Time');
$structure->addAuxiliaryField($auxiliary);
// Add icon image
$icon = new Image(ICON_FILE, 'icon');
$pass->addImage($icon);
// Set pass structure
$pass->setStructure($structure);
// Add barcode
$barcode = new Barcode(Barcode::TYPE_QR, 'barcodeMessage');
$pass->setBarcode($barcode);
// Create pass factory instance
$factory = new PassFactory(PASS_TYPE_IDENTIFIER, TEAM_IDENTIFIER, ORGANIZATION_NAME, P12_FILE, P12_PASSWORD, WWDR_FILE);
$factory->setOutputPath(OUTPUT_PATH);
$factory->package($pass);
php composer.phar install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.