Example #1
0
            {
                "key": "id",
                "label": "Card Number",
                "value": "' . $id . '"
            }
        ]
    },
    "barcode": {
        "format": "PKBarcodeFormatPDF417",
        "message": "' . $id . '",
        "messageEncoding": "iso-8859-1",
        "altText": "' . $id . '"
    }
    }');
    // add files to the PKPass package
    $pass->addFile('icon.png');
    $pass->addFile('*****@*****.**');
    $pass->addFile('logo.png');
    $pass->addFile('background.png', 'strip.png');
    if (!$pass->create(true)) {
        // Create and output the PKPass
        echo 'Error: ' . $pass->getError();
    }
    exit;
} else {
    // User lands here, there are no $_POST variables set
    ?>
	<html>
	<head>
		<title>Starbucks pass creator - PHP class demo</title>
Example #2
0
                "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"
    },
    "barcode": {
        "format": "PKBarcodeFormatQR",
        "message": "Flight-GateF12-ID6643679AH7B",
        "messageEncoding": "iso-8859-1"
    }
}');
// add files to the PKPass package
$pass->addFile('images/icon.png');
$pass->addFile('images/icon@2x.png');
$pass->addFile('images/logo.png');
$pass->create(true);
// Create and output the PKPass
Example #3
0
                "value": "' . $passenger . '"
            }
        ],
        "transitType" : "PKTransitTypeAir"
    },
    "barcode": {
        "format": "PKBarcodeFormatQR",
        "message": "Flight-Gate' . $gate . '-' . $date . '-' . $passenger . '-' . $destination . '",
        "messageEncoding": "iso-8859-1"
    }
    }');
    if ($pass->checkError($error) == true) {
        exit('An error occured: ' . $error);
    }
    // add files to the PKPass package
    $pass->addFile('../images/icon.png');
    $pass->addFile('../images/icon@2x.png');
    $pass->addFile('../images/logo.png');
    // specify english and french localizations
    $pass->addFile('en.strings', 'en.lproj/pass.strings');
    $pass->addFile('fr.strings', 'fr.lproj/pass.strings');
    if ($pass->checkError($error) == true) {
        exit('An error occured: ' . $error);
    }
    //If you pass true, the class will output the zip into the browser.
    $result = $pass->create(true);
    if ($result == false) {
        // Create and output the PKPass
        echo $pass->getError();
    }
} else {