subster / php-sdk
Unofficial PHP SDK for Subster
v0.0.3
2025-05-15 11:26 UTC
Requires
- php: ^8.1
- nesbot/carbon: ^3.8
- saloonphp/saloon: ^3.0
Requires (Dev)
- laravel/pint: ^1.17
- pestphp/pest: ^1.22
- symfony/var-dumper: ^7.2
README
Work in progress. Not ready for production yet!
Requirements
- PHP 8.1 or later.
Installation
Install via composer:
composer require subster/php-sdk
Usage
Create a checkout session
use Subster\PhpSdk\SubsterConnector; use Subster\PhpSdk\DataObjects\CreateCheckoutSessionData; $subster = new SubsterConnector('your-api-key'); $session = $subster->checkoutSessions()->create( CreateCheckoutSessionData::from([ 'customer' => 'customer-id', 'items' => [ [ 'plan' => 'your-plan-id', ], ], 'success_url' => 'https://example.ru/success', 'cancel_url' => 'https://example.ru/cancel', ]) );
Create a billing portal session
use Subster\PhpSdk\SubsterConnector; use Subster\PhpSdk\DataObjects\CreateBillingPortalSessionData; $subster = new SubsterConnector('your-api-key'); $session = $subster->billingPortalSessions()->create( CreateBillingPortalSessionData::from([ 'customer' => 'customer-id', 'return_url' => 'https://example.ru/billing', ]) );
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.