laulamanapps/google-wallet-symfony
Composer 安装命令:
composer require laulamanapps/google-wallet-symfony
包简介
Google Wallet integration for your Symfony application
README 文档
README
This package provides Symfony integration for the LauLamanApps Google Wallet Package.
Requirements
- PHP 8.1+
- Symfony 6.4, 7.x, or 8.x
Installation
composer require laulamanapps/google-wallet-symfony
Register the bundle (skipped automatically when using Symfony Flex):
// config/bundles.php return [ // ... LauLamanApps\GoogleWalletBundle\GoogleWalletBundle::class => ['all' => true], ];
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
# config/packages/laulamanapps_google_wallet.yaml laulamanapps_google_wallet: service_account: '%env(GOOGLE_WALLET_SERVICE_ACCOUNT)%' origins: - 'https://example.com'
Add the ENV variable to the .env file:
###> laulamanapps/google-wallet-symfony ### GOOGLE_WALLET_SERVICE_ACCOUNT=config/secrets/google-wallet-service-account.json ###< laulamanapps/google-wallet-symfony ###
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 |
Usage
Inject the SaveUrlFactory to create "Save to Google Wallet" links:
namespace App\Controller; use LauLamanApps\GoogleWallet\PassPayload; use LauLamanApps\GoogleWallet\SaveUrlFactory; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Response; class WalletController { public function __construct( private readonly SaveUrlFactory $saveUrlFactory, ) { } public function save(): Response { $payload = new PassPayload(); // ... build your pass, see the laulamanapps/google-wallet README return new RedirectResponse($this->saveUrlFactory->create($payload)); } }
See the laulamanapps/google-wallet README for details on building pass objects and classes.
Credits
This package has been developed by LauLaman.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-08