vatly / vatly-laravel
Laravel integration for Vatly, inspired by Laravel Cashier
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
pkg:composer/vatly/vatly-laravel
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/http: ^11.0|^12.0
- illuminate/routing: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
- vatly/vatly-fluent-php: ^0.2.0-alpha.1
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
This package is auto-updated.
Last update: 2026-02-27 18:32:42 UTC
README
Alpha release -- under active development. Expect breaking changes.
Laravel integration for Vatly billing, inspired by Laravel Cashier. Provides Eloquent models, a Billable trait, checkout/subscription builders, webhook handling, and event listeners.
Built on top of vatly/vatly-fluent-php.
Installation
composer require vatly/vatly-laravel:v0.1.0-alpha.1
Pin to an exact version. This is an alpha release and the API will change.
Requirements
- PHP 8.2+
- Laravel 10, 11, or 12
- A Vatly API key (vatly.com)
Setup
- Publish the config:
php artisan vendor:publish --tag=vatly-config
- Add your API key to
.env:
VATLY_API_KEY=test_xxxxxxxxxxxx
VATLY_WEBHOOK_SECRET=your-webhook-secret
- Publish and run migrations:
php artisan vendor:publish --tag=vatly-migrations php artisan vendor:publish --tag=vatly-billable-migrations php artisan migrate
- Add the
Billabletrait to your User model:
use Vatly\Fluent\Contracts\BillableInterface; use Vatly\Laravel\Billable; class User extends Authenticatable implements BillableInterface { use Billable; }
Usage
// Create a checkout $checkout = $user->newCheckout() ->withItems(collect(['subscription_plan_id'])) ->create( redirectUrlSuccess: 'https://example.com/success', redirectUrlCanceled: 'https://example.com/canceled', ); // Swap subscription plan $user->subscription('default')->swap('plan_premium'); // Cancel subscription $user->subscription('default')->cancel();
Webhooks
The package registers a webhook endpoint at /vatly/webhook automatically. Configure your webhook secret in the Vatly dashboard.
Events dispatched:
Vatly\Events\WebhookReceivedVatly\Events\SubscriptionStartedVatly\Events\SubscriptionCanceledImmediatelyVatly\Events\SubscriptionCanceledWithGracePeriod
Testing
composer test
License
MIT