Download the PHP package laulamanapps/google-wallet without Composer

On this page you can find all versions of the php package laulamanapps/google-wallet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package google-wallet

Google Wallet

Generate Google Wallet passes from PHP. The Google counterpart of laulamanapps/apple-passbook.

Passes are distributed via "Add to Google Wallet" links: an RS256-signed JWT whose payload embeds the pass classes and objects (a so-called "fat JWT"). Because the classes and objects travel inside the JWT, no Google Wallet REST API call is needed — the only dependency is ext-openssl for signing.

Installation

Or use one of the framework integrations, which wire the service account and save-URL factory from configuration:

Service account setup

  1. Sign up for a Google Wallet issuer account in the Google Pay & Wallet Console and note your issuer id.
  2. Create a Google Cloud service account with the Wallet Object Issuer role and download its JSON key file.
  3. Link the service account to your issuer account in the console.

Quickstart

Render the url as an Add to Google Wallet button and you are done.

Pass types

Next to GenericClass/GenericObject the same pattern is available for:

Add them to the PassPayload with the matching add*Class()/add*Object() methods.

Location-triggered notifications

Google Wallet shows a Nearby Passes notification when a pass holder is close to one of the pass's merchant locations (the user must have granted always-on location access; Google controls the notification text and timing). Add up to 10 locations per object:

Updating passes

Once a pass is saved to a wallet you can change it through the Google Wallet REST API. Unlike Apple Passbook there are no push tokens or APNs involved: Google pushes updates to devices automatically after an API call. The API client uses ext-curl by default (or bring your own HttpClient implementation); an OAuth2 access token is obtained and cached for you via the service-account JWT-bearer grant.

The same pattern works for classes (insertClass(), updateClass(), patchClass()) and for all pass types. Errors surface as LauLamanApps\GoogleWallet\Exception\ApiException.

Receiving save/delete callbacks

Google can notify you whenever a user saves or deletes a pass. Set a callback url on the pass class (available on all five class types) and Google will POST a signed message to that endpoint on every save and delete:

Google signs every callback with the ECv2SigningOnly scheme (ECDSA over NIST P-256 with SHA-256, sender GooglePayPasses, your issuer id as recipient). Verify the raw request body with CallbackVerifier; it fetches Google's root signing keys, checks the intermediate signing key against them, checks the message signature against the intermediate key and rejects expired keys and messages:

[!WARNING] Never act on a callback without running it through CallbackVerifier. The endpoint is public and anyone can POST to it; only the signature chain proves the request came from Google. verify() never returns unverified data — every failure throws a CallbackException.

Callbacks are best-effort and may arrive more than once: use getNonce() to deduplicate. Reuse one CallbackVerifier/GoogleKeyProvider instance where possible — the root signing keys are cached per GoogleKeyProvider instance. GoogleKeyProvider::test() points at Google's test root keys for integration testing.

Signing a JWT yourself

SaveUrlFactory covers the common case. If you need the raw JWT, use JwtSigner directly:

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of google-wallet with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-openssl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laulamanapps/google-wallet contains the following files

Loading the files please wait ...