laulamanapps/wallet-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

laulamanapps/wallet-laravel

Composer 安装命令:

composer require laulamanapps/wallet-laravel

包简介

Platform-agnostic wallet pass generation for your Laravel application

README 文档

README

This package provides Laravel integration for the LauLamanApps Wallet SDK: platform-agnostic wallet pass generation for your Laravel application. Describe a pass once and generate it for Apple Wallet (.pkpass files), Google Wallet ("Save to Google Wallet" links) or any custom platform.

Requirements

  • PHP 8.1+
  • Laravel 11.x, 12.x or 13.x

Installation

composer require laulamanapps/wallet-laravel

The service provider (LauLamanApps\WalletLaravel\WalletServiceProvider) is registered automatically via Laravel package auto-discovery. It registers LauLamanApps\Wallet\Wallet as a singleton (also available under the wallet container alias).

To generate passes for a specific platform, install the matching bridge packages:

# Apple Wallet: binds the Compiler the Apple bridge needs
composer require laulamanapps/apple-passbook laulamanapps/apple-passbook-laravel

# Google Wallet: binds the SaveUrlFactory the Google bridge needs
composer require laulamanapps/google-wallet laulamanapps/google-wallet-laravel

Run Tests

composer install
./bin/phpunit

Configuration

Publish the config file:

php artisan vendor:publish --tag=wallet-config

This creates config/wallet.php:

Key Default Description
apple.enabled env('WALLET_APPLE_ENABLED', false) Register the Apple bridge (.pkpass files)
google.enabled env('WALLET_GOOGLE_ENABLED', false) Register the Google bridge ("Save to Google Wallet" links)
google.issuer_id env('GOOGLE_WALLET_ISSUER_ID') Your Google Wallet issuer id (required when Google is enabled)
google.class_suffix null Optional class suffix; null derives it from the pass type

Example .env:

WALLET_APPLE_ENABLED=true
WALLET_GOOGLE_ENABLED=true
GOOGLE_WALLET_ISSUER_ID=3388000000012345678

Usage

Build a platform-agnostic Pass and let the Wallet generate the platform-specific result:

<?php

use LauLamanApps\Wallet\MetaData\Barcode;
use LauLamanApps\Wallet\MetaData\BarcodeFormat;
use LauLamanApps\Wallet\Pass;
use LauLamanApps\Wallet\PassType;
use LauLamanApps\Wallet\Wallet;

class TicketController
{
    public function download(Wallet $wallet)
    {
        $pass = new Pass('4de81ef8', PassType::EventTicket, 'LauLaman Apps', 'Concert ticket');
        $pass->addBarcode(new Barcode(BarcodeFormat::Qr, '4de81ef8'));

        // Generate for a single platform
        $generated = $wallet->generate('apple', $pass);

        if ($generated->isFile()) {
            return response($generated->getContent(), 200, [
                'Content-Type' => $generated->getMimeType(),
                'Content-Disposition' => 'attachment; filename="' . $generated->getFilename() . '"',
            ]);
        }

        return redirect()->away($generated->getUrl());
    }
}

Or generate the pass for every enabled platform at once:

foreach ($wallet->generateForAllPlatforms($pass) as $platform => $generated) {
    // $generated->isFile() ? $generated->getContent() : $generated->getUrl()
}

Custom platforms

Any service tagged wallet.pass_generator that implements LauLamanApps\Wallet\PassGenerator is registered on the Wallet automatically. In one of your application's service providers:

<?php

use LauLamanApps\WalletLaravel\WalletServiceProvider;

public function register(): void
{
    $this->app->tag(AcmePassGenerator::class, WalletServiceProvider::PASS_GENERATOR_TAG);
    // or: $this->app->tag(AcmePassGenerator::class, 'wallet.pass_generator');
}
$wallet->generate('acme', $pass);

Credits

This package was created by Laurens Laman.

License

This package is licensed under the MIT License.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固