PHPackages                             lanos/revenuecat-sdk-php - 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. lanos/revenuecat-sdk-php

ActiveLibrary[API Development](/categories/api)

lanos/revenuecat-sdk-php
========================

A PHP SDK for the RevenueCat API

v1.0.0(1y ago)5121MITPHPPHP ^8.1

Since Dec 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/l4nos/revenue-cat-sdk-php)[ Packagist](https://packagist.org/packages/lanos/revenuecat-sdk-php)[ RSS](/packages/lanos-revenuecat-sdk-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

RevenueCat PHP SDK
==================

[](#revenuecat-php-sdk)

A modern PHP SDK for the RevenueCat API, following SOLID principles and PSR standards.

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

[](#installation)

You can install the package via composer:

```
composer require lanos/revenuecat-sdk-php
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

```
use Lanos\RevenueCat\Config\Configuration;
use Lanos\RevenueCat\RevenueCatClient;

// Create a configuration instance
$config = new Configuration('your-api-key');

// Create the RevenueCat client
$client = new RevenueCatClient($config);
```

### Working with Customers

[](#working-with-customers)

```
// Get a customer
$customer = $client->customers()->get('project-id', 'customer-id');

// List customers
$customers = $client->customers()->list('project-id', [
    'limit' => 10,
    'starting_after' => 'last-customer-id'
]);

// Create a customer
$customer = $client->customers()->create('project-id', [
    'id' => 'customer-id',
    'attributes' => [
        ['name' => '$email', 'value' => 'customer@example.com']
    ]
]);

// Get customer's active entitlements
$entitlements = $client->customers()->getActiveEntitlements('project-id', 'customer-id');
```

### Working with Entitlements

[](#working-with-entitlements)

```
// Get an entitlement
$entitlement = $client->entitlements()->get('project-id', 'entitlement-id');

// List entitlements
$entitlements = $client->entitlements()->list('project-id');

// Create an entitlement
$entitlement = $client->entitlements()->create('project-id', [
    'lookup_key' => 'premium',
    'display_name' => 'Premium Access'
]);

// Attach products to an entitlement
$client->entitlements()->attachProducts('project-id', 'entitlement-id', [
    'product_ids' => ['product-1', 'product-2']
]);
```

### Working with Products

[](#working-with-products)

```
// Get a product
$product = $client->products()->get('project-id', 'product-id');

// List products
$products = $client->products()->list('project-id', [
    'app_id' => 'app-id'
]);

// Create a product
$product = $client->products()->create('project-id', [
    'store_identifier' => 'com.example.product',
    'type' => 'subscription',
    'app_id' => 'app-id'
]);
```

### Working with Offerings

[](#working-with-offerings)

```
// Get an offering
$offering = $client->offerings()->get('project-id', 'offering-id');

// List offerings
$offerings = $client->offerings()->list('project-id');

// Create an offering
$offering = $client->offerings()->create('project-id', [
    'lookup_key' => 'default',
    'display_name' => 'Standard Offering'
]);
```

### Working with Packages

[](#working-with-packages)

```
// Get a package
$package = $client->packages()->get('project-id', 'package-id');

// Update a package
$package = $client->packages()->update('project-id', 'package-id', [
    'display_name' => 'New Package Name'
]);

// Attach products to a package
$client->packages()->attachProducts('project-id', 'package-id', [
    'products' => [
        [
            'product_id' => 'product-id',
            'eligibility_criteria' => 'all'
        ]
    ]
]);
```

Error Handling
--------------

[](#error-handling)

The SDK throws specific exceptions for different types of errors:

```
use Lanos\RevenueCat\Exceptions\AuthenticationException;
use Lanos\RevenueCat\Exceptions\AuthorizationException;
use Lanos\RevenueCat\Exceptions\NotFoundException;
use Lanos\RevenueCat\Exceptions\ValidationException;
use Lanos\RevenueCat\Exceptions\RateLimitException;
use Lanos\RevenueCat\Exceptions\ServerException;

try {
    $client->customers()->get('project-id', 'customer-id');
} catch (AuthenticationException $e) {
    // Handle invalid API key
} catch (AuthorizationException $e) {
    // Handle permission issues
} catch (NotFoundException $e) {
    // Handle resource not found
} catch (ValidationException $e) {
    // Handle validation errors
} catch (RateLimitException $e) {
    // Handle rate limiting
    $backoffMs = $e->getBackoffMs();
} catch (ServerException $e) {
    // Handle server errors
}
```

Configuration Options
---------------------

[](#configuration-options)

You can customize the client configuration:

```
$config = new Configuration(
    apiKey: 'your-api-key',
    timeout: 30, // Request timeout in seconds
    headers: [
        'Custom-Header' => 'Value'
    ]
);
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

562d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31861108?v=4)[Rob](/maintainers/l4nos)[@l4nos](https://github.com/l4nos)

---

Top Contributors

[![rl-carno](https://avatars.githubusercontent.com/u/132678025?v=4)](https://github.com/rl-carno "rl-carno (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lanos-revenuecat-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/lanos-revenuecat-sdk-php/health.svg)](https://phpackages.com/packages/lanos-revenuecat-sdk-php)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6513.9M11](/packages/aporat-store-receipt-validator)

PHPackages © 2026

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