$pass->setJSON('{
	"passTypeIdentifier": "pass.com.apple.test",
	"formatVersion": 1,
	"organizationName": "Flight Express",
	"serialNumber": "123456",
	"teamIdentifier": "AGK5BZEN3E",
	"backgroundColor": "rgb(107,156,196)",
	"logoText": "FLIGHT_INFO_LABEL",
	"description": "Demo pass",
	"boardingPass": {
        "primaryFields": [
            {
            	"key" : "origin",
            	"label" : "' . $origin_label . '",
            	"value" : "' . $origin . '"
            },
            {
            	"key" : "destination",
            	"label" : "' . $destination_label . '",
            	"value" : "' . $destination . '"
            }
        ],
        "secondaryFields": [
            {
                "key": "gate",
                "label": "GATE_LABEL",
                "value": "' . $gate . '"
            },
            {
                "key": "date",
                "label": "DEPARTURE_DATE_LABEL",
                "value": "' . $date . '"
            }

        ],
        "backFields": [
            {
                "key": "passenger-name",
                "label": "Passenger",
                "value": "' . $passenger . '"
            }
        ],
        "transitType" : "PKTransitTypeAir"
    },
    "barcode": {
        "format": "PKBarcodeFormatQR",
        "message": "Flight-Gate' . $gate . '-' . $date . '-' . $passenger . '-' . $destination . '",
        "messageEncoding": "iso-8859-1"
    }
    }');
    $pass->setJSON('{
	"passTypeIdentifier": "pass.com.apple.test",
	"formatVersion": 1,
	"organizationName": "Starbucks",
	"teamIdentifier": "AGK5BZEN3E",
	"serialNumber": "' . $id . '",
    "backgroundColor": "rgb(240,240,240)",
	"logoText": "Starbucks",
	"description": "Demo pass",
	"storeCard": {
        "secondaryFields": [
            {
                "key": "balance",
                "label": "BALANCE",
                "value": "' . $balance . '"
            },
            {
                "key": "name",
                "label": "NICKNAME",
                "value": "' . $name . '"
            }

        ],
        "backFields": [
            {
                "key": "id",
                "label": "Card Number",
                "value": "' . $id . '"
            }
        ]
    },
    "barcode": {
        "format": "PKBarcodeFormatPDF417",
        "message": "' . $id . '",
        "messageEncoding": "iso-8859-1",
        "altText": "' . $id . '"
    }
    }');
<?php

use PKPass\PKPass;
require '../PKPass.php';
$pass = new PKPass();
$pass->setCertificate('../Certificate.p12');
// 1. Set the path to your Pass Certificate (.p12 file)
$pass->setCertificatePassword('test123');
// 2. Set password for certificate
$pass->setWWDRcertPath('../AppleWWDRCA.pem');
// 3. Set the path to your WWDR Intermediate certificate (.pem file)
// Top-Level Keys http://developer.apple.com/library/ios/#documentation/userexperience/Reference/PassKit_Bundle/Chapters/TopLevel.html
$standardKeys = ['description' => 'Demo pass', 'formatVersion' => 1, 'organizationName' => 'Flight Express', 'passTypeIdentifier' => 'pass.com.apple.test', 'serialNumber' => '123456', 'teamIdentifier' => 'AGK5BZEN3E'];
$associatedAppKeys = [];
$relevanceKeys = [];
$styleKeys = ['boardingPass' => ['primaryFields' => [['key' => 'origin', 'label' => 'San Francisco', 'value' => 'SFO'], ['key' => 'destination', 'label' => 'London', 'value' => 'LHR']], 'secondaryFields' => [['key' => 'gate', 'label' => 'Gate', 'value' => 'F12'], ['key' => 'date', 'label' => 'Departure date', 'value' => '07/11/2012 10:22']], 'backFields' => [['key' => 'passenger-name', 'label' => 'Passenger', 'value' => 'John Appleseed']], 'transitType' => 'PKTransitTypeAir']];
$visualAppearanceKeys = ['barcode' => ['format' => 'PKBarcodeFormatQR', 'message' => 'Flight-GateF12-ID6643679AH7B', 'messageEncoding' => 'iso-8859-1'], 'backgroundColor' => 'rgb(107,156,196)', 'logoText' => 'Flight info'];
$webServiceKeys = [];
// Merge all pass data and set JSON for $pass object
$passData = array_merge($standardKeys, $associatedAppKeys, $relevanceKeys, $styleKeys, $visualAppearanceKeys, $webServiceKeys);
$pass->setJSON(json_encode($passData));
// Add files to the PKPass package
$pass->addFile('images/icon.png');
$pass->addFile('images/icon@2x.png');
$pass->addFile('images/logo.png');
if (!$pass->create(true)) {
    // Create and output the PKPass
    echo 'Error: ' . $pass->getError();
}