承接 laulamanapps/wallet-symfony 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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:

  • Applelaulamanapps_wallet.bridge.apple receives the LauLamanApps\ApplePassbook\Build\Compiler service. Install laulamanapps/apple-passbook-bundle, which registers that service (including certificate/signing configuration), or define a Compiler service yourself.
  • Googlelaulamanapps_wallet.bridge.google receives the LauLamanApps\GoogleWallet\SaveUrlFactory service. Install laulamanapps/google-wallet-symfony, which registers that service from your service account credentials, or define a SaveUrlFactory service 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
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固