PHPackages                             rudderstack/rudder-php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rudderstack/rudder-php-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rudderstack/rudder-php-sdk
==========================

RudderStack Analytics SDK PHP library

2.1.0(2y ago)71.4M↓10.8%[1 issues](https://github.com/rudderlabs/rudder-php-sdk/issues)[9 PRs](https://github.com/rudderlabs/rudder-php-sdk/pulls)1MITPHPPHP ^7.4 || ^8.0

Since Mar 26Pushed 2mo ago7 watchersCompare

[ Source](https://github.com/rudderlabs/rudder-php-sdk)[ Packagist](https://packagist.org/packages/rudderstack/rudder-php-sdk)[ Docs](https://rudderstack.com/)[ RSS](/packages/rudderstack-rudder-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (19)Used By (1)

What is RudderStack?
====================

[](#what-is-rudderstack)

[RudderStack](https://rudderstack.com/) is a **customer data pipeline** tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.

More information on RudderStack can be found [here](https://github.com/rudderlabs/rudder-server).

Getting Started with PHP SDK
----------------------------

[](#getting-started-with-php-sdk)

Install `rudder-php-sdk` using `composer`

```
git clone https://github.com/rudderlabs/rudder-php-sdk /my/app/folders/

```

Initialize the `Client`
-----------------------

[](#initialize-the-client)

```
use Rudder\Rudder;

require_once realpath(__DIR__ . '/vendor/autoload.php');

Rudder::init(WRITE_KEY, array(
  "data_plane_url" => DATA_PLANE_URL,
  "consumer"       => "lib_curl",
  "debug"          => true,
  "max_queue_size" => 10000,
  "flush_at"     => 100
));

```

SDK Initialization options
--------------------------

[](#sdk-initialization-options)

Below parameters are optional and can be passed during SDK initialization.

NameTypeDefault valueDescription`consumer`String`lib_curl`To explicitly mark which consumer to use.`data_plane_url`String`hosted.rudderlabs.com`The data plane URL.`debug`Boolean`false`Whether to log messages and wait for a response. Makes any queuing consumers non-async, defaults to false. This will make the library block until a response has been received from the API, so it is not recommended for production use.`ssl`Boolean`true`Whether to use SSL for the connection.`tls`String`false`Whether to use TLS instead of SSL for the socket connection.`error_handler`Function`function ($code, $message) {}`A handler which will be called on errors to aid in debugging. A function to handle errors, particularly useful for debugging. Note that if debug mode is not specified, then the error\_handler will only be called on connection level errors and timeouts.`max_queue_size`Number`10000`The max number of items in the queue .`flush_at`Number`100`How many items to send in a single curl request .`timeout`Number`0.5`The number of seconds to wait for the socket request to time out .`filename`String`/tmp/analytics.log`The location to write the log file when file consumer is selected.`compress_request`Boolean`true`Whether to use gzipped request payloads. This is supported for server versions 1.4.0 and above.`flush_inteval`Number`10000`Frequency in milliseconds to send data using flush method execution.`curl_timeout`Number`0 (infinite)`Set timeout for the curl connections.`curl_connecttimeout`Number`300`Set connect timeout for the curl connections.`max_item_size_bytes`Number`32000`Set maximum message item size in bytes.`max_queue_size_bytes`Number`512000`Set maximum batch size in bytes.`filepermissions`Number`0644`Set the file permissions for file consumer.Send Events
-----------

[](#send-events)

```
Rudder::track(array(
  "userId" => "f4ca124298",
  "event" => "Signed Up",
  "properties" => array(
    "plan" => "Enterprise"
  )
));

```

Acknowledgements
----------------

[](#acknowledgements)

This project is a fork of [analytics-php](https://github.com/segmentio/analytics-php) by \[segmentio\].

Contact Us
----------

[](#contact-us)

If you come across any issues while configuring or using this SDK, feel free to start a conversation on our [Slack](https://resources.rudderstack.com/join-rudderstack-slack) channel. We will be happy to help you.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance55

Moderate activity, may be stable

Popularity44

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~245 days

Total

5

Last Release

896d ago

Major Versions

1.0.1 → 2.0.02023-01-05

PHP version history (2 changes)1.0.0PHP &gt;=5.3.3

2.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/073d56a3250ca86590a11fae2e15155d1f15d7ce4191f4e4d3502409f8e1105d?d=identicon)[rudderlabs](/maintainers/rudderlabs)

---

Top Contributors

[![bardisg](https://avatars.githubusercontent.com/u/109069547?v=4)](https://github.com/bardisg "bardisg (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (20 commits)")[![shrouti1507](https://avatars.githubusercontent.com/u/60211312?v=4)](https://github.com/shrouti1507 "shrouti1507 (10 commits)")[![arnab-p](https://avatars.githubusercontent.com/u/30770913?v=4)](https://github.com/arnab-p "arnab-p (6 commits)")[![Shivam4415](https://avatars.githubusercontent.com/u/25522437?v=4)](https://github.com/Shivam4415 "Shivam4415 (3 commits)")[![stepsecurity-app[bot]](https://avatars.githubusercontent.com/in/1053343?v=4)](https://github.com/stepsecurity-app[bot] "stepsecurity-app[bot] (2 commits)")[![ishachopra0401](https://avatars.githubusercontent.com/u/97496803?v=4)](https://github.com/ishachopra0401 "ishachopra0401 (2 commits)")[![MoumitaM](https://avatars.githubusercontent.com/u/36885121?v=4)](https://github.com/MoumitaM "MoumitaM (2 commits)")[![1abhishekpandey](https://avatars.githubusercontent.com/u/64667840?v=4)](https://github.com/1abhishekpandey "1abhishekpandey (1 commits)")

---

Tags

analyticsrudderrudderstackrudderanalytics.js

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/rudderstack-rudder-php-sdk/health.svg)

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

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[segmentio/analytics-php

Segment Analytics PHP Library

25621.5M25](/packages/segmentio-analytics-php)[panphp/pan

A simple, lightweight, and privacy-focused product analytics php package.

1.2k94.6k5](/packages/panphp-pan)[zumba/amplitude-php

PHP SDK for Amplitude

409.5M5](/packages/zumba-amplitude-php)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)

PHPackages © 2026

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