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

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

segmentio/analytics-php
=======================

Segment Analytics PHP Library

3.8.2(3mo ago)25922.3M↓25.8%127[2 issues](https://github.com/segmentio/analytics-php/issues)[2 PRs](https://github.com/segmentio/analytics-php/pulls)20MITPHPPHP ^7.4 || ^8.0CI passing

Since Feb 11Pushed 1w ago46 watchersCompare

[ Source](https://github.com/segmentio/analytics-php)[ Packagist](https://packagist.org/packages/segmentio/analytics-php)[ Docs](https://segment.com/libraries/php)[ RSS](/packages/segmentio-analytics-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (14)Versions (79)Used By (20)

analytics-php
=============

[](#analytics-php)

[![Test status](https://github.com/segmentio/analytics-php/workflows/Tests/badge.svg)](https://github.com/segmentio/analytics-php/actions)[![codecov.io](https://camo.githubusercontent.com/d2e1d988f31eae1acd2205097edade03fd20ad98bcd3769fcc63464996227e1b/68747470733a2f2f636f6465636f762e696f2f67682f7365676d656e74696f2f616e616c79746963732d7068702f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d694f525a70776d596d4d)](https://codecov.io/gh/segmentio/analytics-php)

analytics-php is a php client for [Segment](https://segment.com)

### ⚠️ Maintenance ⚠️

[](#️-maintenance-️)

This library is in maintenance mode. It will send data as intended, but receive no new feature support and only critical maintenance updates from Segment.

 [![](https://user-images.githubusercontent.com/16131737/53616825-4bd81c00-3b99-11e9-819a-f5fdf527d3c4.png)](https://user-images.githubusercontent.com/16131737/53616825-4bd81c00-3b99-11e9-819a-f5fdf527d3c4.png)***You can't fix what you can't measure***

Analytics helps you measure your users, product, and business. It unlocks insights into your app's funnel, core business metrics, and whether you have product-market fit.

How to get started
------------------

[](#how-to-get-started)

1. **Collect analytics data** from your app(s).
    - The top 200 Segment companies collect data from 5+ source types (web, mobile, server, CRM, etc.).
2. **Send the data to analytics tools** (for example, Google Analytics, Amplitude, Mixpanel).
    - Over 250+ Segment companies send data to eight categories of destinations such as analytics tools, warehouses, email marketing and remarketing systems, session recording, and more.
3. **Explore your data** by creating metrics (for example, new signups, retention cohorts, and revenue generation).
    - The best Segment companies use retention cohorts to measure product market fit. Netflix has 70% paid retention after 12 months, 30% after 7 years.

[Segment](https://segment.com) collects analytics data and allows you to send it to more than 250 apps (such as Google Analytics, Mixpanel, Optimizely, Facebook Ads, Slack, Sentry) just by flipping a switch. You only need one Segment code snippet, and you can turn integrations on and off at will, with no additional code. [Sign up with Segment today](https://app.segment.com/signup).

### Why?

[](#why)

1. **Power all your analytics apps with the same data**. Instead of writing code to integrate all of your tools individually, send data to Segment, once.
2. **Install tracking for the last time**. We're the last integration you'll ever need to write. You only need to instrument Segment once. Reduce all of your tracking code and advertising tags into a single set of API calls.
3. **Send data from anywhere**. Send Segment data from any device, and we'll transform and send it on to any tool.
4. **Query your data in SQL**. Slice, dice, and analyze your data in detail with Segment SQL. We'll transform and load your customer behavioral data directly from your apps into Amazon Redshift, Google BigQuery, or Postgres. Save weeks of engineering time by not having to invent your own data warehouse and ETL pipeline.

    For example, you can capture data on any app:

    ```
    analytics.track('Order Completed', { price: 99.84 })
    ```

    Then, query the resulting data in SQL:

    ```
    select * from app.order_completed
    order by price desc
    ```

### 🚀 Startup Program

[](#-startup-program)

 [![](https://user-images.githubusercontent.com/16131737/53128952-08d3d400-351b-11e9-9730-7da35adda781.png)](https://segment.com/startups)

If you are part of a new startup (&lt;$5M raised, &lt;2 years since founding), we just launched a new startup program for you. You can get a Segment Team plan (up to **$25,000 value** in Segment credits) for free up to 2 years — [apply here](https://segment.com/startups/)! Documentation
-------------

[](#documentation)

Documentation is available at [segment.com/docs/sources/server/php](https://segment.com/docs/sources/server/php/)

Releasing
---------

[](#releasing)

Run `make release VERSION=`. It should automatically tag and release in composer

License
-------

[](#license)

```
WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

```

(The MIT License)

Copyright (c) 2014 Segment Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

75

—

ExcellentBetter than 100% of packages

Maintenance91

Actively maintained with recent releases

Popularity68

Solid adoption and visibility

Community47

Growing community involvement

Maturity83

Battle-tested with a long release history

 Bus Factor4

4 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 ~99 days

Recently: every ~270 days

Total

49

Last Release

90d ago

Major Versions

0.4.8 → 1.x-dev2014-06-17

1.8.0 → 2.0.02021-07-16

2.0.0 → 3.5.02022-08-18

2.1.0 → 3.6.02023-03-28

PHP version history (4 changes)0.2.2PHP &gt;=5.3

1.1.1PHP &gt;=5.3.3

2.0.0PHP &gt;=7.4

3.5.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8881f12644ed84189c6eb10ad4ca08c2eefa96b89d59a4310a271e53856c7c55?d=identicon)[Segmentio](/maintainers/Segmentio)

![](https://www.gravatar.com/avatar/1308f2d66ea2b7c19a008dc0eef70915dd9a2b87796e84b8cf40d885af0de376?d=identicon)[segmentkellylu](/maintainers/segmentkellylu)

---

Top Contributors

[![nd4p90x](https://avatars.githubusercontent.com/u/2658588?v=4)](https://github.com/nd4p90x "nd4p90x (111 commits)")[![yields](https://avatars.githubusercontent.com/u/1661587?v=4)](https://github.com/yields "yields (31 commits)")[![dailycoding](https://avatars.githubusercontent.com/u/13878119?v=4)](https://github.com/dailycoding "dailycoding (30 commits)")[![f2prateek](https://avatars.githubusercontent.com/u/843979?v=4)](https://github.com/f2prateek "f2prateek (29 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (23 commits)")[![pooyaj](https://avatars.githubusercontent.com/u/2992515?v=4)](https://github.com/pooyaj "pooyaj (23 commits)")[![calvinfo](https://avatars.githubusercontent.com/u/487539?v=4)](https://github.com/calvinfo "calvinfo (22 commits)")[![lubird](https://avatars.githubusercontent.com/u/7109746?v=4)](https://github.com/lubird "lubird (18 commits)")[![MichaelGHSeg](https://avatars.githubusercontent.com/u/101233650?v=4)](https://github.com/MichaelGHSeg "MichaelGHSeg (10 commits)")[![brennan](https://avatars.githubusercontent.com/u/11224497?v=4)](https://github.com/brennan "brennan (9 commits)")[![dominicbarnes](https://avatars.githubusercontent.com/u/160197?v=4)](https://github.com/dominicbarnes "dominicbarnes (8 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (6 commits)")[![MindfullyLoko](https://avatars.githubusercontent.com/u/59059891?v=4)](https://github.com/MindfullyLoko "MindfullyLoko (5 commits)")[![kzap](https://avatars.githubusercontent.com/u/62213?v=4)](https://github.com/kzap "kzap (3 commits)")[![Cethy](https://avatars.githubusercontent.com/u/735030?v=4)](https://github.com/Cethy "Cethy (3 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (2 commits)")[![Robertbaelde](https://avatars.githubusercontent.com/u/4356288?v=4)](https://github.com/Robertbaelde "Robertbaelde (2 commits)")[![villfa](https://avatars.githubusercontent.com/u/2891564?v=4)](https://github.com/villfa "villfa (2 commits)")[![inaniyants](https://avatars.githubusercontent.com/u/4038277?v=4)](https://github.com/inaniyants "inaniyants (2 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (2 commits)")

---

Tags

analyticssegmentioanalytics.jssegment

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/segmentio-analytics-php/health.svg)

```
[![Health](https://phpackages.com/badges/segmentio-analytics-php/health.svg)](https://phpackages.com/packages/segmentio-analytics-php)
```

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k6.0M66](/packages/spatie-laravel-analytics)[rubix/ml

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

2.2k1.5M28](/packages/rubix-ml)[panphp/pan

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

1.3k106.0k5](/packages/panphp-pan)[zumba/amplitude-php

PHP SDK for Amplitude

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

Google Analytics integration for FilamentPHP

208175.5k8](/packages/bezhansalleh-filament-google-analytics)[appsero/client

Appsero Client

25492.4k10](/packages/appsero-client)

PHPackages © 2026

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