PHP code example of nocego / yii2-wallet
1. Go to this page and download the library: Download nocego/yii2-wallet 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/ */
nocego / yii2-wallet example snippets
'wallet' => [
'class' => 'nocego\yii2\wallet\Module',
'canManageTickets' => ['admin'],
'googleWalletConfig' => [
'issuerId' => '1234567891011121314',
'googleServiceAccountCredentials' => [
"type" => "type",
"project_id" => "project_id",
"private_key_id" => "private_key_id",
"private_key" => "-----BEGIN PRIVATE KEY-----\nprivate_key\n-----END PRIVATE KEY-----\n",
"client_email" => "client_email",
"client_id" => "123456789101112131415",
"auth_uri" => "auth_uri",
"token_uri" => "token_uri",
"auth_provider_x509_cert_url" => "auth_provider_x509_cert_url",
"client_x509_cert_url" => "client_x509_cert_url",
"universe_domain" => "universe_domain",
],
'timeToAddToValidTimeIntervalEnd' => 'P7D',
],
'pkPassConfig' => [
'certificatePath' => /srv/www/www.test.org/certificates/pkpass/certificates.p12,
'certificatePassword' => '12.34#56',
'organizationName' => 'MyOrganization',
'passTypeIdentifier' => 'pass.org.test.myapp',
'teamIdentifier' => 'AB1CDEFG2K',
'iconUrl' => 'https://test.org/files/Wallet/icon.png',
'logoUrl' => 'https://test.org/files/Wallet/icon.png',
],
]
$pkPassFields = [
'description' => 'Test PKPass Ticket',
'serialNumber' => '1234567890',
'organizationName' => 'MyOrganization',
'logoText' => 'My PKPass Ticket',
'foregroundColor' => 'rgb(255, 255, 255)',
'backgroundColor' => 'rgb(0, 0, 0)',
// Add other necessary fields here
];
$pkPass = new PkpassModel();
$pkPass->getTicket($pkPassFields);
// Google Wallet example
$classSuffix = 'test_class_suffix';
$classType = 'eventticket
$classFields = [
'ticketFields' => [
'eventName' => [
'defaultValue' => [
'language' => 'en-US',
'value' => 'Test Event',
],
],
'issuerName' => 'Test Issuer',
// Add other necessary fields here
],
];
$wallet = new GoogleWallet();
$success = $wallet->createClass($classSuffix, $classFields, $classType);
$classSuffix = 'test_class_suffix';
$objectSuffix = 'test_object_suffix';
$classFields = [
'ticketFields' => [
'ticketHolderName' => 'John Doe',
'barcode': {
'type': 'QR_CODE',
'value': 1234567890,
},
// Add other necessary fields here
],
];
$wallet = new GoogleWallet();
$wallet->createTicket($classSuffix, $objectSuffix, $classFields);