Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiiya/laravel-passes
Laravel package for creating iOS and Android Wallet Passes.
https://github.com/chiiya/laravel-passes
Last synced: 7 days ago
JSON representation
Laravel package for creating iOS and Android Wallet Passes.
- Host: GitHub
- URL: https://github.com/chiiya/laravel-passes
- Owner: chiiya
- License: mit
- Created: 2022-03-04T14:36:43.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-10T13:44:57.000Z (28 days ago)
- Last Synced: 2024-10-30T02:43:00.431Z (8 days ago)
- Language: PHP
- Size: 52.7 KB
- Stars: 21
- Watchers: 1
- Forks: 8
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Laravel Passes
[![Latest Version on Packagist](https://img.shields.io/packagist/v/chiiya/laravel-passes.svg?style=flat-square)](https://packagist.org/packages/chiiya/laravel-passes)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/chiiya/laravel-passes/lint?label=code%20style)](https://github.com/chiiya/laravel-passes/actions?query=workflow%3Alint+branch%3Amaster)
[![Total Downloads](https://img.shields.io/packagist/dt/chiiya/laravel-passes.svg?style=flat-square)](https://packagist.org/packages/chiiya/laravel-passes)Laravel package for creating iOS and Android Wallet Passes.
## Installation
You can install the package via composer:
```bash
composer require chiiya/laravel-passes
```Publish the configuration files with:
```bash
php artisan vendor:publish --tag="passes-config"
```## Usage
This package is a thin wrapper around [chiiya/passes](https://github.com/chiiya/passes), that allows you to directly
inject the Google repositories or Apple `PassFactory` in your application:```php
public function __construct(
private OfferClassRepository $offers,
private PassFactory $apple,
)public function handle(): void
{
$this->apple->create(...);
$this->offers->get(...);
}
```You may also use the `PassBuilder` class, which is an entry point to all pass building functionalities and contains
a helper method for creating a signed Google JWT:```php
use Chiiya\LaravelPasses\PassBuilder;public function __construct(
private PassBuilder $builder,
)public function handle(): void
{
$this->builder->apple()->create(...);
$this->builder->google()->offerClasses()->create(...);
$this->builder->google()->createJWT()->addOfferObject(...)->sign();
}
```For documentation on method signatures, check out [chiiya/passes](https://github.com/chiiya/passes).
## Testing
Since this package uses the Laravel HTTP Client under the hood to perform API requests,
you may simply call `Http::fake()` to fake responses in your tests. For mocking specific responses,
check out the [example responses](https://github.com/chiiya/passes/tree/master/tests/Google/Fixtures/responses).## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.