Download the PHP package gigerit/laravel-swiss-post-postcard-api-client without Composer
On this page you can find all versions of the php package gigerit/laravel-swiss-post-postcard-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gigerit/laravel-swiss-post-postcard-api-client
More information about gigerit/laravel-swiss-post-postcard-api-client
Files in gigerit/laravel-swiss-post-postcard-api-client
Package laravel-swiss-post-postcard-api-client
Short Description This is my package laravel-swiss-post-postcard-api-client
License MIT
Homepage https://github.com/gigerit/laravel-swiss-post-postcard-api-client
Informations about the package laravel-swiss-post-postcard-api-client
Laravel Swiss Post Postcard API Client
A Laravel package for sending physical postcards through the Swiss Post Postcard API. This package provides a complete, type-safe wrapper around the Swiss Post Postcard API, allowing you to programmatically send real postcards with images, addresses, branding, and QR codes.
Features:
- ๐ Complete API coverage for all Swiss Post Postcard endpoints
- ๐ OAuth2 authentication with automatic token management
- โ Client-side validation for addresses, text, and image dimensions
- ๐จ Support for branding (text, images, QR codes, custom stamps)
- ๐ง Type-safe DTOs for all request and response data
- ๐ก๏ธ Comprehensive error handling with descriptive error codes
- ๐ฑ Laravel facades and dependency injection support
- ๐งช Built with Saloon HTTP client and OAuth2 for robust API communication
Requirements
- PHP 8.3 or higher
- Laravel 10.0, 11.0, 12.0, or 13.0
- Swiss Post Postcard API credentials (obtained through contract with Swiss Post)
Installation
Install the package via Composer:
Publish the configuration file:
Configuration
Add your Swiss Post API credentials to your .env file:
Note: The URLs shown above are for the integration environment. Swiss Post will provide you with production URLs and credentials upon contract signing.
Quick Start
Using Dependency Injection
Using Facades
Manual Instantiation
Core Concepts
Postcard Workflow
- Check quota - Verify campaign has remaining postcards
- Create postcard - Initialize with recipient address
- Upload content - Add image, sender text, addresses
- Add branding - Optional logos, QR codes, custom stamps
- Approve - Submit for printing and sending
Image Requirements
| Type | Dimensions | Format | Purpose |
|---|---|---|---|
| Front Image | 1819ร1311 px | JPEG/PNG | Main postcard image |
| Branding Image | 777ร295 px | JPEG/PNG | Company branding |
| Stamp | 343ร248 px | JPEG/PNG | Custom stamp |
All images should be RGB color mode at 300 DPI for optimal print quality.
Address Validation
The package validates addresses according to Swiss Post requirements:
- Required fields: street, ZIP, city, country (for recipients)
- Name requirements: firstname/lastname OR company name
- Text length limits enforced
- Character encoding validation (CP850 compatibility)
API Services
The package is organized into three main services:
PostcardService
BrandingService
CampaignService
Error Handling
The package provides comprehensive error handling:
Validation
Client-side validation helps catch errors before API calls:
Advanced Usage
For more detailed examples and advanced usage patterns, see USAGE_EXAMPLES.md.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Manu
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-swiss-post-postcard-api-client with dependencies
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
saloonphp/saloon Version ^4.0
spatie/laravel-package-tools Version ^1.16