Skip to content
Fans API
[official php sdk]

OnlyFans
PHP SDK

A typed, production-ready PHP client for the OnlyFans API. Authenticate once, call any endpoint, and ship reliable creator tools with less boilerplate.

Install
composer require onlyfansapi/onlyfansapi-php
/PHP 8.1+/Sync & Async Clients/Configurable Retries
[code examples]

Link stats, chats, messages, media

Fetch cumulative clicks, subscribers, spenders, and lifetime revenue for a tracking link, then derive ARPS from the summary totals.
<?php

use Onlyfansapi\Client;

$client = new Client(apiKey: getenv('ONLYFANSAPI_API_KEY'));

// GET /api/{account}/tracking-links/{tracking_link_id}/stats
$stats = $client->trackingLinks->getStats('123456', account: 'acct_XXXXXXXXXXXXX');

$summary = $stats->data->summary;
$arps = $summary->subsTotal ? $summary->revenueTotal / $summary->subsTotal : 0;

echo "Clicks: {$summary->clicksTotal} · Subs: {$summary->subsTotal}", PHP_EOL;
echo "Spenders: {$summary->spendersTotal}", PHP_EOL;
printf("ARPS: $%.2f · Lifetime: $%.2f", $arps, $summary->revenueTotal);
// Output:
// Clicks: 1240 · Subs: 300
// Spenders: 42
// ARPS: $12.40 · Lifetime: $3720.00
[features]

Clean integrations for
modern PHP

Expressive calls, structured responses, and dependable behavior in production.

  • Modern PHP

    Built for PHP 8.1+ with current language features and conventions.

  • Configurable retries

    Tune retries globally or override them for an individual request.

  • Focused exceptions

    Handle connection, timeout, authentication, rate-limit, and API errors separately.

[built for real products]

Turn API access into useful creator tools

Use one consistent client across dashboards, internal operations, and automated workflows.

  • Analytics Dashboards

    Bring account and performance data into reporting experiences your team can act on.

  • Media Workflows

    Build upload flows around familiar file, stream, and byte-based objects.

  • Internal Automation

    Build upload flows around familiar file, stream, and byte-based objects.

  • Multi-account tools

    Create focused interfaces for teams working across multiple connected accounts.

  • Reporting Pipelines

    Move structured API responses into warehouses, spreadsheets, and custom reports.

  • Custom integrations

    Extend the typed client with custom requests when your product needs more flexibility.

[keep exploring]

Everything you need
for the next step

Move from the quick start to complete endpoint details and source code.

  • Screenshot of the PHP SDK documentation

    PHP SDK docs

    Installation, configuration, examples, and language-specific guidance.

  • Screenshot of the OnlyFans API reference

    API reference

    Explore endpoints, parameters, response schemas, and error details.

  • Screenshot of the onlyfansapi-php GitHub repository

    Source on GitHub

    Review the SDK source, releases, examples, and contribution guide.

[faq]

Questions before you start

The questions agencies and developers actually ask, answered by the team that runs proxies at scale.

Do you have more questions?Contact Us

PHP SDK hero
[start building]

Build your next integration with PHP

Install the SDK, connect your API key, and make your first OnlyFans API request in minutes.