Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Mobile Pass Laravel Package

spatie/laravel-mobile-pass

Laravel package to generate Apple Wallet mobile passes (boarding passes, tickets, coupons, cards) with support for pushing updates to issued passes so they stay current on users’ devices. In development—don’t use in production yet.

View on GitHub
Deep Wiki
Context7

title: Generating your first pass weight: 3

The package offers [various builder classes](TODO: add link) that you can use to build passes. These builders all have specialized methods to build their specific passes.

Here's an example of how you can generate a basic airline boarding pass:

use Spatie\LaravelMobilePass\Builders\Apple\AirlinePassBuilder;
use Spatie\LaravelMobilePass\Builders\Apple\Entities\FieldContent;
use Spatie\LaravelMobilePass\Builders\Apple\Entities\Image;
use Spatie\LaravelMobilePass\Builders\Apple\Entities\Seat;

$mobilePass = AirlinePassBuilder::make()
    ->setOrganisationName('My organisation')
    ->setSerialNumber(123456)
    ->setDescription('Hello!')
    ->setHeaderFields(
        FieldContent::make('flight-no')
            ->withLabel('Flight')
            ->withValue('EY066'),
        FieldContent::make('seat')
            ->withLabel('Seat')
            ->withValue('66F')
    )
    ->setPrimaryFields(
        FieldContent::make('departure')
            ->withLabel('Abu Dhabi International')
            ->withValue('ABU'),
        FieldContent::make('destination')
            ->withLabel('London Heathrow')
            ->withValue('LHR'),
    )
    ->setSecondaryFields(
        FieldContent::make('name')
            ->withLabel('Name')
            ->withValue('Dan Johnson'),
        FieldContent::make('gate')
            ->withLabel('Gate')
            ->withValue('D68')
    )
    ->setAuxiliaryFields(
        FieldContent::make('departs')
            ->withLabel('Departs')
            ->withValue(now()->toIso8601String()),
        FieldContent::make('class')
            ->withLabel('Class')
            ->withValue('Economy'),
    )
    ->setIconImage(
        Image::make(
            x1Path: public_path('images/your-thumbnail.png')
        )
    )

    // Now set the semantic fields.
    ->setDepartureAirportCode('AUH')
    ->setDepartureAirportName('Abu Dhabi Intl')
    ->setDepartureLocationDescription('Abu Dhabi Intl')
    ->setDestinationAirportCode('LHR')
    ->setDestinationAirportName('London Heathrow')
    ->setDestinationLocationDescription('Abu Dhabi Intl')
    ->setSeats(Seat::make(
        number: '66F',
    ));
    ->save();

The save method will return a newly created MobilePass model.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport