PHPackages                             smlv/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. smlv/sdk

ActiveLibrary[Payment Processing](/categories/payments)

smlv/sdk
========

SMLV Platform SDK - Easy integration of SMLV payment system into any SaaS. Includes a CDN-ready JS widget (no iframe) with JWT auth.

v2.3.4(2mo ago)034↓90%MITJavaScriptPHP &gt;=7.4

Since Mar 5Pushed 2mo agoCompare

[ Source](https://github.com/FilSM/smlv-sdk)[ Packagist](https://packagist.org/packages/smlv/sdk)[ RSS](/packages/smlv-sdk/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (4)Versions (46)Used By (0)

SMLV SDK
========

[](#smlv-sdk)

PHP SDK for integrating SMLV billing into your SaaS application.

> **v2.2** — The widget now renders directly into your page DOM (no iframe). Account creation and management are handled fully inside the widget — no extra server-side code required from SaaS developers.

Features
--------

[](#features)

- **Zero account management** — widget auto-resolves or creates the user account on first load
- **No iframe** — widget renders as native DOM elements, fully styleable
- **Secure JWT** — short-lived signed tokens (900 s), never exposed in URLs
- **Full CRUD widget** — Deposit / Balance / Transactions / Account management tabs
- **Headless API** — use `SmlvClient` directly for server-side automation
- **Framework agnostic** — plain PHP, Laravel, Yii2, Symfony

Requirements
------------

[](#requirements)

- PHP 7.4+
- `firebase/php-jwt` ^6.0 || ^7.0

Installation
------------

[](#installation)

```
composer require smlv/sdk
```

Quick Start
-----------

[](#quick-start)

### 1. Initialize the client

[](#1-initialize-the-client)

```
use Smlv\Sdk\SmlvClient;

$smlv = new SmlvClient([
    'api_url'       => 'https://api.smlvcoin.com',
    'api_key'       => 'your-api-key',
    'api_secret'    => 'your-api-secret',
    'widget_secret' => 'your-widget-secret',
]);
```

> Keep credentials in a config file that is excluded from version control (e.g. `main-local.php` in Yii2, `services.php` in Laravel). **Never commit real keys to git.**

### 3. Embed a widget

[](#3-embed-a-widget)

That is literally all you need to show a full billing UI to your user:

```
use Smlv\Sdk\SmlvWidgetGenerator;

$widget = new SmlvWidgetGenerator($smlv);

// $subscriber->id — the subscriber ID in your system.
// One user may have multiple subscribers — pass the subscriber ID, not the user ID!
//
// email — optional, used only to pre-fill the account creation form on first visit.
// Recommended order: 1) main contact email of the subscriber, 2) current user's email.
// If email is unknown — pass an empty string.

echo $widget->generateDepositWidget(
    externalSubscriberId: (string) $subscriber->id,
    email:                $subscriber->contactEmail ?? $currentUser->email ?? '',
    returnUrl:            'https://your-app.com/billing'
);
```

The widget will:

1. Load the SMLV JS bundle from CDN
2. Resolve the user's SMLV account (or show a creation form on first visit)
3. Render the deposit UI directly in your page

**No database column, no `createAccount()` call, no extra routes required.**

Widget Types
------------

[](#widget-types)

```
// Deposit funds
echo $widget->generateDepositWidget($subscriber->id, $email, $returnUrl, $options);

// Balance overview + sync
echo $widget->generateBalanceWidget($subscriber->id, $email, $options);

// Mini inline bar — balance + ⊕ deposit button (ideal for navbars)
echo $widget->generateMiniWidget($subscriber->id, $email, $options);

// Paginated transaction history
echo $widget->generateTransactionsWidget($subscriber->id, $email, $options);

// Full account management (overview / edit / danger zone)
echo $widget->generateManagementWidget($subscriber->id, $email, $options);

// Unified widget: "Create account" OR 4-tab dashboard (Balance | Transactions | Overview | Danger Zone)
echo $widget->generateAccountWidget($subscriber->id, $email, $options);
```

TypeBest forAccount required?`deposit`Standalone deposit pageAuto-resolves`balance`Balance panel / sidebarAuto-resolves`mini`Top navbar inline barNo (direct fetch)`transactions`Transaction history pageAuto-resolves`management`Account settings pageAuto-resolves`account`Subscriber detail pageNo (handles both)All methods return a self-contained HTML snippet:

```

	window._smlvQueue = window._smlvQueue || [];
	window._smlvQueue.push({
		token: 'eyJ...',
		selector: '#smlv-widget-xxxxxxxx',
		type: 'deposit',
		options: {},
	});

```

Options
-------

[](#options)

### Common options

[](#common-options)

KeyTypeDefaultDescription`theme``string``'light'``'light'` or `'dark'``language``string``'en'`UI language code### Deposit options

[](#deposit-options)

KeyTypeDescription`currencies``string[]`Allowed currencies to show`default_currency``string`Pre-selected currency### Balance options

[](#balance-options)

KeyTypeDescription`show_sync``bool`Show Sync button (default `true`)### JS callbacks (inline `` pattern)

[](#js-callbacks-inline-script-pattern)

```
window._smlvQueue = window._smlvQueue || [];
window._smlvQueue.push({
  token:    '
