laulamanapps/wallet-symfony
Composer 安装命令:
composer require laulamanapps/wallet-symfony
包简介
Platform-agnostic wallet pass generation for your Symfony application
关键字:
README 文档
README
Platform-agnostic wallet pass generation for your Symfony application.
This bundle integrates laulamanapps/wallet into Symfony. It wires the
LauLamanApps\Wallet\Wallet service, collects every PassGenerator in your container, and can optionally enable
the built-in Apple and Google bridges.
Installation
composer require laulamanapps/wallet-symfony
Register the bundle (skip when using Symfony Flex):
// config/bundles.php return [ // ... LauLamanApps\WalletBundle\WalletBundle::class => ['all' => true], ];
Configuration
# config/packages/laulamanapps_wallet.yaml laulamanapps_wallet: apple: enabled: true google: enabled: true issuer_id: '%env(GOOGLE_WALLET_ISSUER_ID)%' class_suffix: ~ # optional, defaults to the pass type
Both bridges are disabled by default. When google.enabled is true, issuer_id is required.
How the bridges resolve their engine services
The bridges are thin adapters around the platform SDKs and expect their engine services to be present in the container:
- Apple —
laulamanapps_wallet.bridge.applereceives theLauLamanApps\ApplePassbook\Build\Compilerservice. Installlaulamanapps/apple-passbook-bundle, which registers that service (including certificate/signing configuration), or define aCompilerservice yourself. - Google —
laulamanapps_wallet.bridge.googlereceives theLauLamanApps\GoogleWallet\SaveUrlFactoryservice. Installlaulamanapps/google-wallet-symfony, which registers that service from your service account credentials, or define aSaveUrlFactoryservice yourself:
# config/services.yaml services: LauLamanApps\GoogleWallet\ServiceAccount: factory: ['LauLamanApps\GoogleWallet\ServiceAccount', 'fromJsonFile'] arguments: ['%env(GOOGLE_WALLET_SERVICE_ACCOUNT)%'] LauLamanApps\GoogleWallet\SaveUrlFactory: arguments: ['@LauLamanApps\GoogleWallet\ServiceAccount']
Adding a custom PassGenerator
Any service implementing LauLamanApps\Wallet\PassGenerator is picked up automatically through autoconfiguration —
it is tagged laulamanapps_wallet.pass_generator and registered on the Wallet:
use LauLamanApps\Wallet\GeneratedPass; use LauLamanApps\Wallet\Pass; use LauLamanApps\Wallet\PassGenerator; final class MyPassGenerator implements PassGenerator { public function getPlatform(): string { return 'my-platform'; } public function generate(Pass $pass): GeneratedPass { return GeneratedPass::url('my-platform', 'https://example.com/pass/' . $pass->getId()); } }
No tagging or configuration needed as long as autoconfigure: true is on (the Symfony default).
Generating a pass
Inject the Wallet and generate for the platform you need:
use LauLamanApps\Wallet\Pass; use LauLamanApps\Wallet\PassType; use LauLamanApps\Wallet\Wallet; final class TicketController { public function __construct(private readonly Wallet $wallet) { } public function __invoke(): Response { $pass = new Pass('ticket-4664', PassType::EventTicket, 'LauLaman Apps', 'Awesome Conference'); $generated = $this->wallet->generate('google', $pass); // or 'apple', 'my-platform', ... return new RedirectResponse($generated->getUrl()); } }
Use $wallet->generateForAllPlatforms($pass) to build the pass for every registered platform at once.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-08