PHPackages                             matthiasmullie/ci-sniffer - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. matthiasmullie/ci-sniffer

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

matthiasmullie/ci-sniffer
=========================

Detects which CI environment the code is run and how to fetch details about the code being tested.

1.2.1(10y ago)37701MITPHPPHP ^5.3|^7.0

Since Feb 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/matthiasmullie/ci-sniffer)[ Packagist](https://packagist.org/packages/matthiasmullie/ci-sniffer)[ Docs](http://github.com/matthiasmullie/ci-sniffer)[ RSS](/packages/matthiasmullie-ci-sniffer/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (7)Used By (1)

CI sniffer
==========

[](#ci-sniffer)

[![Code quality](https://camo.githubusercontent.com/226462b40bbeee67e5c857119b73d73b94df1223a1e55e852e522543920b7bd1/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d617474686961736d756c6c69652f63692d736e69666665722e737667)](https://scrutinizer-ci.com/g/matthiasmullie/ci-sniffer)[![Latest version](https://camo.githubusercontent.com/1d33222ccad2f3d57e60c95297a7ec9742349de100bbf12488aca1939d369f68/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617474686961736d756c6c69652f63692d736e69666665722e737667)](https://packagist.org/packages/matthiasmullie/ci-sniffer)[![Downloads total](https://camo.githubusercontent.com/3ebf1192f4d0ce0d20a839920c1e1bd05043bd66d6c428c6ee8ae5d431a198dc/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617474686961736d756c6c69652f63692d736e69666665722e737667)](https://packagist.org/packages/matthiasmullie/ci-sniffer)[![License](https://camo.githubusercontent.com/4a7240071a0953529b8c27c6acc2bec8a38060fb35d384fd47565ddb90d3b7bb/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d617474686961736d756c6c69652f63692d736e69666665722e737667)](https://github.com/matthiasmullie/ci-sniffer/blob/master/LICENSE)

Travis, is that you?
--------------------

[](#travis-is-that-you)

All CI providers set some environment variables to let you know who they are and some additional info, but there's little consistency between how and what they expose. This will figure out what environment you're in and how to access some (sometimes hard to get) data in there, so you don't have to.

Supported CI providers
----------------------

[](#supported-ci-providers)

ProviderStatusAppveyor[![](https://camo.githubusercontent.com/94c00408384d1a43ae66c86e3e5360e6d0d8843eb0437f737bd62b23a2b75345/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f773737306b63336a71636e686c306a743f7376673d74727565)](https://ci.appveyor.com/project/matthiasmullie/ci-sniffer)Circle CI[![](https://camo.githubusercontent.com/b64baf58ae7f303f1673fce59faad1b62a2575b88115ccfcb2505de2dcac26d0/68747470733a2f2f636972636c6563692e636f6d2f67682f6d617474686961736d756c6c69652f63692d736e69666665722e7376673f7374796c653d737667)](https://circleci.com/gh/matthiasmullie/ci-sniffer)Codeship[![](https://camo.githubusercontent.com/22e787cf3ed141156e0843dfa48ec2177914dee8f754021a619e1cdc7d701037/68747470733a2f2f636f6465736869702e636f6d2f70726f6a656374732f64363566613131302d623331382d303133332d323333302d3065353266636462393731312f7374617475733f6272616e63683d6d6173746572)](https://codeship.com/projects/133591)Drone[![](https://camo.githubusercontent.com/8802fc36c1a4716706d349c95ddbdc4a67b8ab0cc9ca9bf1544d7ec9b4442b3a/68747470733a2f2f64726f6e652e696f2f6769746875622e636f6d2f6d617474686961736d756c6c69652f63692d736e69666665722f7374617475732e706e67)](https://drone.io/github.com/matthiasmullie/ci-sniffer)JenkinsSupported!Shippable[![](https://camo.githubusercontent.com/b6350fa261ec8820a83c7b4791989f9b32df6cb3acf29233d1c2fca124797862/68747470733a2f2f6170692e736869707061626c652e636f6d2f70726f6a656374732f3536626461616534313839356361343437343733653335642f62616467653f6272616e63683d6d6173746572)](https://app.shippable.com/projects/56bdaae41895ca447473e35d)Snap CI[![](https://camo.githubusercontent.com/c8a532414ee840cca346388fdf9ff1b64004d6be97c61d40d8ddd61591ab43fe/68747470733a2f2f736e61702d63692e636f6d2f6d617474686961736d756c6c69652f63692d736e69666665722f6272616e63682f6d61737465722f6275696c645f696d616765)](https://snap-ci.com/matthiasmullie/ci-sniffer)Travis CI[![](https://camo.githubusercontent.com/d25cd4c9183a894a5f1c016070fb8fe7ebc4fa0cf931cf0a08f33b1ceecf1973/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d617474686961736d756c6c69652f63692d736e69666665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/matthiasmullie/ci-sniffer)Wercker[![](https://camo.githubusercontent.com/efc6a73beb8a4d8a956020e231a4e118c940587aa8c1dd6bb164dcbfdbcd3325/68747470733a2f2f6170702e776572636b65722e636f6d2f7374617475732f35396566626336656534653136623133646634323634333230303061643836612f73)](https://app.wercker.com/project/bykey/59efbc6ee4e16b13df426432000ad86a)Example usage
-------------

[](#example-usage)

```
$factory = new \MatthiasMullie\CI\Factory();
$provider = $factory->getCurrent();

// outputs 'travis', 'circle', ..., depending on what CI server the code is run
echo $provider->getProvider(); // e.g. 'travis'

// outputs data about the thing being tested
echo $provider->getRepo(); // e.g. 'https://github.com/matthiasmullie/ci-sniffer.git'
echo $provider->getSlug(); // e.g. 'matthiasmullie/ci-sniffer'
echo $provider->getBranch(); // e.g. 'master' (or '', when testing PR)
echo $provider->getPullRequest(); // e.g. '1' (or '', when not testing PR)
echo $provider->getCommit(); // e.g. '01081a9c908717bf315f992b814a36c7c9ba7e65'
echo $provider->getPreviousCommit(); // e.g. '45da9806d50c98f9c88dc0049303cf039b93a95b'
echo $provider->getAuthor(); // e.g. 'Matthias Mullie'
echo $provider->getAuthorEmail(); // e.g. 'ci-sniffer@mullie.eu'
echo $provider->getTimestamp(); // e.g. '2016-02-17T18:36:49+01:00'
echo $provider->getBuild(); // e.g. '62.1'
```

Or execute the binary (`bin/ci-sniffer`) to get all info in JSON format. E.g.:

```
{
    "provider":"travis",
    "repo":"https:\/\/github.com\/matthiasmullie\/ci-sniffer.git",
    "slug":"matthiasmullie\/ci-sniffer",
    "branch":"master",
    "pr":"",
    "commit":"01081a9c908717bf315f992b814a36c7c9ba7e65",
    "previous-commit":"45da9806d50c98f9c88dc0049303cf039b93a95b",
    "author":"Matthias Mullie",
    "author-email":"ci-sniffer@mullie.eu",
    "timestamp":"2016-02-17T18:36:49+01:00",
    "build":"62.1"
}
```

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

[](#installation)

Simply add a dependency on matthiasmullie/ci-sniffer to your composer.json file if you use [Composer](https://getcomposer.org/) to manage the dependencies of your project:

```
composer require matthiasmullie/ci-sniffer
```

Although it's recommended to use Composer, you can actually include these files anyway you want.

License
-------

[](#license)

ci-sniffer is [MIT](http://opensource.org/licenses/MIT) licensed.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~11 days

Total

6

Last Release

3736d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cad3300bf52ada70b17962024941977a92a4da8551cbb92493de23c4bbbb5252?d=identicon)[matthiasmullie](/maintainers/matthiasmullie)

---

Top Contributors

[![matthiasmullie](https://avatars.githubusercontent.com/u/312776?v=4)](https://github.com/matthiasmullie "matthiasmullie (49 commits)")

---

Tags

phpenvironmentcontinuous integrationci

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/matthiasmullie-ci-sniffer/health.svg)

```
[![Health](https://phpackages.com/badges/matthiasmullie-ci-sniffer/health.svg)](https://phpackages.com/packages/matthiasmullie-ci-sniffer)
```

###  Alternatives

[mehrancodes/laravel-harbor

A CLI tool to Quickly create On-Demand preview environment for your apps.

10095.6k](/packages/mehrancodes-laravel-harbor)[techpivot/phalcon-ci-installer

Composer integration for PHP applications to install the Phalcon framework as an extension in the PHP runtime for various hosted CI services including TravisCI, CircleCI, Scrutinizer, Shippable and Codeship.

26130.7k8](/packages/techpivot-phalcon-ci-installer)[etsy/try-lib

Try lib : send your diffs to your CI cluster.

1531.5k](/packages/etsy-try-lib)[epam/ci-bundle

This bundle provides functionality for Continuous Integration &amp; Automated Deployments for Symfony-based projects

297.6k](/packages/epam-ci-bundle)

PHPackages © 2026

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