Download the PHP package laulamanapps/google-wallet-symfony without Composer
On this page you can find all versions of the php package laulamanapps/google-wallet-symfony. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laulamanapps/google-wallet-symfony
More information about laulamanapps/google-wallet-symfony
Files in laulamanapps/google-wallet-symfony
Package google-wallet-symfony
Short Description Google Wallet integration for your Symfony application
License MIT
Informations about the package google-wallet-symfony
Google Wallet Symfony Bundle
This package provides Symfony integration for the LauLamanApps Google Wallet Package.
Requirements
- PHP 8.1+
- Symfony 6.4, 7.x, or 8.x
Installation
Register the bundle (skipped automatically when using Symfony Flex):
Get a Service Account
Head over to the Google Wallet Console and create a service account with access to the Google Wallet API. Download the JSON key file for that service account.
Configure Bundle
Add the ENV variable to the .env file:
Security note: always reference the service-account key file path through
%env(...)%as shown above. A literal value in the bundle configuration would be written into Symfony's compiled container invar/cache.
Configuration reference
| Key | Required | Default | Description |
|---|---|---|---|
service_account |
yes | — | Path to the Google service-account JSON key file |
origins |
no | [] |
Allowed origins for the Save to Google Wallet button |
callback.enabled |
no | false |
Enable the save/delete callback (webhook) endpoint |
callback.issuer_id |
when enabled | null |
Your Google Wallet issuer id, used to verify callback signatures |
callback.environment |
no | 'production' |
Google root signing keys to verify against: production / test |
Usage
Inject the SaveUrlFactory to create "Save to Google Wallet" links:
See the laulamanapps/google-wallet README for details on building pass objects and classes.
Save/delete callbacks
Google can notify your application whenever a user saves or deletes a pass. The bundle ships
a ready-made webhook endpoint that verifies each callback (Google's ECv2SigningOnly
signature scheme) and turns it into a Symfony event. Verification is enforced server-side:
unverifiable requests are rejected with a 400 response and no event is dispatched, so your
listeners only ever see messages that provably came from Google.
1. Enable the callback endpoint
2. Import the routes
or in yaml:
This exposes a single route, googlewallet_callback: POST /google-wallet/callback.
3. Register the callback url on your pass classes
Google only sends callbacks for passes whose class declares a callback url. Set your public
HTTPS URL (Google requires https://) on the pass classes you create:
4. Listen to the events
The endpoint dispatches LauLamanApps\GoogleWalletBundle\Event\PassSavedEvent when a user
saves a pass and LauLamanApps\GoogleWalletBundle\Event\PassDeletedEvent when a user deletes
one:
Both events expose the verified message via getCallbackEvent(), which returns the core
lib's CallbackEvent (event type, expiration and nonce). Callbacks are delivered at least
once, so use getCallbackEvent()->getNonce() to deduplicate.
Credits
This package has been developed by LauLaman.
All versions of google-wallet-symfony with dependencies
laulamanapps/google-wallet Version ^1.0
symfony/framework-bundle Version ^6.4|^7.0|^8.0