vatly/vatly-fluent-php

Framework-agnostic fluent PHP SDK for Vatly billing

Installs: 80

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

pkg:composer/vatly/vatly-fluent-php

v0.2.0-alpha.2 2026-02-27 00:58 UTC

README

Latest Version on Packagist Tests Total Downloads

Alpha release -- under active development. Expect breaking changes.

Framework-agnostic fluent PHP SDK for Vatly billing. Wraps the vatly-api-php client with expressive, action-based methods for managing subscriptions, checkouts, customers, and webhooks.

This package serves as the core logic layer, designed to be portable across PHP frameworks and as a reference for future language ports (JS, Python).

Installation

composer require vatly/vatly-fluent-php:v0.1.0-alpha.1

Pin to an exact version. This is an alpha release and the API will change.

Requirements

What's included

  • Actions: CreateCheckout, CreateCustomer, GetCheckout, GetCustomer, GetSubscription, GetPaymentMethodUpdateUrl, CancelSubscription, SwapSubscriptionPlan
  • Webhook handling: Signature verification, event factory, typed event objects
  • Contracts: BillableInterface, repository interfaces for framework integration
  • Responses: Typed response objects for all actions

Usage

use Vatly\API\VatlyApiClient;
use Vatly\Fluent\Actions\CreateCheckout;

$client = new VatlyApiClient();
$client->setApiKey('test_xxxxxxxxxxxx');

$checkout = new CreateCheckout($client);
$response = $checkout->execute([
    'products' => ['subscription_plan_id'],
    'customerId' => 'cust_xxx',
    'redirectUrlSuccess' => 'https://example.com/success',
    'redirectUrlCanceled' => 'https://example.com/canceled',
]);

For framework integrations

If you're using Laravel, see vatly/vatly-laravel which provides Eloquent models, traits, builders, and event listeners on top of this package.

Testing

composer test

License

MIT