PHPackages                             stellarsecurity/subscription-laravel - 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. [API Development](/categories/api)
4. /
5. stellarsecurity/subscription-laravel

ActiveLibrary[API Development](/categories/api)

stellarsecurity/subscription-laravel
====================================

Stellar Security Subscription client for PHP/Laravel – simple wrapper around the Stellar Subscription API.

1.0.4(1mo ago)0486MITPHPPHP &gt;=8.1

Since Nov 29Pushed 1mo agoCompare

[ Source](https://github.com/StellarSecurity-Packages/stellarsecurity-subscription-laravel)[ Packagist](https://packagist.org/packages/stellarsecurity/subscription-laravel)[ RSS](/packages/stellarsecurity-subscription-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)DependenciesVersions (5)Used By (0)

Stellar Security Subscription Laravel
=====================================

[](#stellar-security-subscription-laravel)

Lightweight Laravel wrapper for the internal **Stellar Subscription API**.
It gives you a `SubscriptionService` for subscriptions and a dedicated `SubscriptionEventService` for subscription events. Both are available through facades so other Stellar apps can reuse them via `composer require`.

> All comments in code are in English.

---

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

[](#installation)

```
composer require stellarsecurity/subscription-laravel
```

Laravel package auto-discovery will register the service provider and facade for you:

- Provider: `StellarSecurity\SubscriptionLaravel\Providers\SubscriptionServiceProvider`
- Facade: `StellarSubscription`
- Event facade: `StellarSubscriptionEvent`

If you want to disable auto-discovery, you can still register them manually in `config/app.php`.

---

Configuration
-------------

[](#configuration)

Publish the config (optional):

```
php artisan vendor:publish --tag=stellar-subscription-config
```

Environment variables used:

```
# External API base URL (normally you keep the default)
STELLAR_SUBSCRIPTION_BASE_URL=https://stellersubscriptionapiprod.azurewebsites.net/api/

# Names of env vars that hold Basic Auth credentials
STELLAR_SUBSCRIPTION_USERNAME_ENV=APPSETTING_API_USERNAME_STELLER_SUBSCRIPTION_API
STELLAR_SUBSCRIPTION_PASSWORD_ENV=APPSETTING_API_PASSWORD_STELLER_SUBSCRIPTION_API

# And then you actually define these:
APPSETTING_API_USERNAME_STELLER_SUBSCRIPTION_API=your-username
APPSETTING_API_PASSWORD_STELLER_SUBSCRIPTION_API=your-password
```

---

Usage
-----

[](#usage)

### Via Facade

[](#via-facade)

```
use StellarSubscription;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionType;

// Find all subscriptions for a user
$response = StellarSubscription::findUserSubscriptions(123, SubscriptionType::VPN->value);

if ($response->successful()) {
    $data = $response->json();
}
```

### Via Dependency Injection

[](#via-dependency-injection)

```
use StellarSecurity\SubscriptionLaravel\SubscriptionService;

class SomeController
{
    public function index(SubscriptionService $subs)
    {
        $response = $subs->user(123);

        if ($response->successful()) {
            // ...
        }
    }
}
```

### Dedicated Event Service via Dependency Injection

[](#dedicated-event-service-via-dependency-injection)

```
use StellarSecurity\SubscriptionLaravel\SubscriptionEventService;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionEventType;

class VpnTelemetryController
{
    public function login(SubscriptionEventService $events)
    {
        return $events->add([
            'subscription_id' => 'subscription-uuid',
            'event_type' => SubscriptionEventType::VPN_LOGIN->value,
            'event_source' => 'stellar_vpn_android',
            'meta' => [
                'app_version' => '1.0.0',
            ],
        ]);
    }
}
```

---

Create subscriptions with source
--------------------------------

[](#create-subscriptions-with-source)

`source` and `source_meta` are optional. Old calls without these fields continue to work.

```
use StellarSubscription;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionSource;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionStatus;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionType;

$response = StellarSubscription::add([
    'user_id' => 123,
    'type' => SubscriptionType::VPN->value,
    'status' => SubscriptionStatus::ACTIVE->value,
    'expires_at' => '2026-07-28 00:00:00',
    'source' => SubscriptionSource::ESIM_PURCHASE->value,
    'source_meta' => [
        'order_id' => 'order_123',
        'product_slug' => 'albania-esim',
    ],
]);
```

Direct VPN purchase example:

```
$response = StellarSubscription::add([
    'user_id' => 123,
    'type' => SubscriptionType::VPN->value,
    'status' => SubscriptionStatus::ACTIVE->value,
    'expires_at' => '2026-07-28 00:00:00',
    'source' => SubscriptionSource::DIRECT_VPN_PURCHASE->value,
    'source_meta' => [
        'payment_provider' => 'stripe',
        'order_id' => 'order_456',
    ],
]);
```

Patch source/source\_meta later if needed:

```
$response = StellarSubscription::patch([
    'id' => 'subscription-uuid',
    'source' => SubscriptionSource::DIRECT_VPN_PURCHASE->value,
    'source_meta' => [
        'payment_provider' => 'crypto',
    ],
]);
```

---

Subscription events
-------------------

[](#subscription-events)

Events are optional. Apps that do not send events do not need to change anything.

Use the dedicated `SubscriptionEventService` / `StellarSubscriptionEvent` facade for new code.

```
use StellarSubscriptionEvent;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionEventType;

$response = StellarSubscriptionEvent::add([
    'subscription_id' => 'subscription-uuid',
    'event_type' => SubscriptionEventType::VPN_LOGIN->value,
    'event_source' => 'stellar_vpn_android',
    'meta' => [
        'app_version' => '1.0.0',
    ],
]);
```

Aliases are also available:

```
StellarSubscriptionEvent::event([...]);
```

Read events:

```
$event = StellarSubscriptionEvent::find(1);
$subscriptionEvents = StellarSubscriptionEvent::findBySubscription('subscription-uuid');
$userEvents = StellarSubscriptionEvent::findByUser(123);
```

Aliases:

```
StellarSubscriptionEvent::subscription('subscription-uuid');
StellarSubscriptionEvent::user(123);
```

Backward-compatible event methods still exist on `StellarSubscription`, but new code should use `StellarSubscriptionEvent`.

---

Enums
-----

[](#enums)

The package ships with simple enums you can reuse across projects:

```
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionStatus;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionType;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionSource;
use StellarSecurity\SubscriptionLaravel\Enums\SubscriptionEventType;

SubscriptionStatus::ACTIVE;
SubscriptionType::ANTIVIRUS;
SubscriptionSource::ESIM_PURCHASE;
SubscriptionEventType::VPN_LOGIN;
```

Subscription sources:

```
SubscriptionSource::ESIM_PURCHASE;
SubscriptionSource::DIRECT_VPN_PURCHASE;
SubscriptionSource::DIRECT_ANTIVIRUS_PURCHASE;
SubscriptionSource::AFFILIATE_VPN_PURCHASE;
SubscriptionSource::ADMIN_GRANTED;
SubscriptionSource::PROMO_GRANTED;
```

Subscription event types:

```
SubscriptionEventType::VPN_LOGIN;
SubscriptionEventType::VPN_CONNECTED;
SubscriptionEventType::VPN_SESSION_STARTED;
SubscriptionEventType::VPN_SESSION_ENDED;
SubscriptionEventType::VPN_LOCATION_SELECTED;
SubscriptionEventType::APP_OPENED;
SubscriptionEventType::PLAN_ACTIVATED;
SubscriptionEventType::PAYMENT_SUCCEEDED;
SubscriptionEventType::PAYMENT_FAILED;
SubscriptionEventType::SUBSCRIPTION_RENEWED;
SubscriptionEventType::SUBSCRIPTION_CANCELLED;
```

---

About Stellar Security
----------------------

[](#about-stellar-security)

Stellar Security is building a Swiss-based privacy &amp; security ecosystem:
hardened phones, VPN, antivirus, secure cloud, and more — all designed with a security-first mindset.

This package is a small building block so **any** Stellar Laravel app can talk to the shared Subscription API using one consistent client.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~70 days

Total

4

Last Release

50d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/150491881?v=4)[Bob](/maintainers/stellar-security-os)[@stellar-security-os](https://github.com/stellar-security-os)

---

Top Contributors

[![stellar-security-os](https://avatars.githubusercontent.com/u/150491881?v=4)](https://github.com/stellar-security-os "stellar-security-os (7 commits)")[![bleko1234](https://avatars.githubusercontent.com/u/14978903?v=4)](https://github.com/bleko1234 "bleko1234 (2 commits)")

### Embed Badge

![Health badge](/badges/stellarsecurity-subscription-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/stellarsecurity-subscription-laravel/health.svg)](https://phpackages.com/packages/stellarsecurity-subscription-laravel)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.5M7](/packages/exsyst-swagger)[lucasdotvin/laravel-soulbscription

A straightforward interface to handle subscriptions and features consumption.

709209.3k](/packages/lucasdotvin-laravel-soulbscription)[pimax/fb-messenger-php

Facebook Messenger Bot PHP API

313188.5k2](/packages/pimax-fb-messenger-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
