Download the PHP package as2aas/php-client without Composer
On this page you can find all versions of the php package as2aas/php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download as2aas/php-client
More information about as2aas/php-client
Files in as2aas/php-client
Package php-client
Short Description PHP client library for AS2aaS - Making AS2 messaging as simple as sending an email
License MIT
Homepage https://github.com/as2aas/php-client
Informations about the package php-client
AS2aaS PHP Client
A comprehensive PHP client library for AS2aaS (AS2 as a Service), designed to simplify AS2 messaging integration for business applications. This library abstracts the complexity of AS2 protocol implementation, enabling developers to integrate secure B2B messaging with just a few lines of code.
Overview
AS2aaS provides a cloud-based AS2 messaging service that handles the complex technical requirements of AS2 protocol implementation. This PHP client library offers a clean, intuitive API for integrating AS2 messaging capabilities into your business applications.
Key Use Cases:
- Healthcare and pharmaceutical supply chain (DSCSA compliance)
- Retail and manufacturing EDI transactions
- Financial services secure document exchange
- Any B2B integration requiring AS2 protocol compliance
Installation
Install the package via Composer:
Laravel Installation
For Laravel applications, the service provider is automatically registered via package discovery. Publish the configuration file:
Add your API key to your .env file:
Quick Start
Laravel Quick Start
Features
- Simple API: Send AS2 messages with minimal code complexity
- Laravel Ready: First-class Laravel integration with service provider and facades
- Enterprise Architecture: Account-based multi-tenant support
- Master Partner Management: Centralized partner configuration with inheritance
- Automatic Security: Built-in signing, encryption, and compression handling
- Real-time Notifications: Webhook integration for message status updates
- Comprehensive Error Handling: Detailed exception management with retry logic
- Content Detection: Automatic EDI, XML, and JSON content type recognition
Configuration
Environment Variables
Configure your API key using environment variables:
Advanced Configuration
Global Configuration
Core Usage Examples
Partner Management
Message Operations
Certificate Management
Webhook Event Handling
Enterprise Features and Tenant Management
Tenant Context Rules
- Account-level modules (accounts, tenants, billing): No
X-Tenant-IDheader needed - Tenant-scoped modules (partners, messages, certificates, webhooks): Require
X-Tenant-IDheader - Automatic header management: Client automatically adds header based on current tenant context
- Default behavior:
- Account keys (
pk_*): Defaults to first tenant if no tenant set - Tenant keys (
tk_*): Automatically scoped to their specific tenant
- Account keys (
Master Partner Inheritance Flow
The complete 7-step inheritance process:
- Create Master Partner: Account-level partner creation
- List Master Partners: View all master partners with inheritance stats
- Check Inheritance Status: See which tenants inherit which partners
- Inherit to Tenants: Bulk or individual inheritance with custom settings
- View Tenant Partners: Combined view of inherited + tenant-specific partners
- Remove Inheritance: Selective removal from specific tenants
- Update Master Partner: Changes automatically propagate to inherited partners
Benefits:
- Centralized Management: Create once, inherit everywhere
- Tenant Customization: Override settings per tenant (URL, MDN mode, etc.)
- Automatic Sync: Master partner changes propagate automatically
- Selective Control: Choose which tenants inherit which partners
- Audit Trail: Track all inheritance relationships and changes
Testing
Unit Testing with Mock Client
For unit testing your application without making actual API calls, use the built-in mock client:
Integration Testing with Test Environment
For integration testing against the AS2aaS test environment:
Laravel Testing
Utility Functions
Laravel Integration
Installation
The service provider is automatically registered. Publish the configuration:
Configuration
Add to your .env file:
Usage in Laravel
Webhook Handling in Laravel
Error Handling
The client provides comprehensive error handling with specific exception types:
Multi-Tenant Architecture
AS2aaS supports enterprise multi-tenant architectures where you can manage multiple business entities or customers within a single account:
Account and Tenant Management
Master Partner Inheritance
Create master partners at the account level and inherit them to specific tenants:
Industry-Specific Integration
Healthcare and Pharmaceutical (DSCSA)
The client is designed to support Drug Supply Chain Security Act (DSCSA) compliance requirements:
Testing
Run the test suite:
Run with coverage:
Run static analysis:
Check code style:
API Reference
Client Initialization
new Client(string $apiKey)- Initialize with API keynew Client(array $config)- Initialize with configuration arrayClient::createTest(string $apiKey)- Create test environment clientClient::configure(array $config)- Set global configuration
Core Modules
partners()- Partner management and lookupmessages()- Message sending and receivingcertificates()- Certificate upload and managementaccounts()- Account-level operations (enterprise)tenants()- Tenant management and context switchingwebhooks()- Webhook event handlingbilling()- Subscription and usage managementsandbox()- Testing and development utilitiespartnerships()- Advanced partner onboardingutils()- Helper functions and content detection
Requirements
- PHP 8.0 or higher
- Guzzle HTTP client 7.0+
- OpenSSL extension for certificate operations
- JSON extension for API communication
Contributing
Please see CONTRIBUTING for details on our code of conduct and the process for submitting pull requests.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Support
- Documentation: https://docs.as2aas.com
- Support: [email protected]
- Issues: https://github.com/as2aas/php-client/issues
About AS2aaS
AS2aaS is a cloud-based AS2 messaging service that eliminates the complexity of implementing and maintaining AS2 infrastructure. Our platform handles the technical requirements of AS2 protocol compliance while providing a simple, developer-friendly API for integration.
Perfect for businesses requiring secure B2B document exchange, including healthcare organizations needing DSCSA compliance, retail companies managing EDI transactions, and any enterprise requiring AS2 protocol support.