PHPackages                             elementary/gelf-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. elementary/gelf-php

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

elementary/gelf-php
===================

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

1.5.5.1(7y ago)0441MITPHPPHP &gt;=5.3.9

Since Dec 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/php-elementary/gelf-php)[ Packagist](https://packagist.org/packages/elementary/gelf-php)[ RSS](/packages/elementary-gelf-php/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (4)Versions (29)Used By (1)

gelf-php [![Latest Stable Version](https://camo.githubusercontent.com/df2d23418a03f4ae8679180f405530c3a22d012f2a7752e436221792ee32f120/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677261796c6f67322f67656c662d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graylog2/gelf-php) [![Total Downloads](https://camo.githubusercontent.com/7a2798916fc660e6fffb2d5248df05da49d6a14ea96f38599dc55218233567b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f677261796c6f67322f67656c662d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graylog2/gelf-php)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#gelf-php--)

[![Build Status](https://camo.githubusercontent.com/94e91184484aad5625db6e377246f953d24d447cd399f07a762c600b3a2117f8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f627a696b6172736b792f67656c662d7068702e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bzikarsky/gelf-php)[![Code Coverage](https://camo.githubusercontent.com/c24981a3267d31eeaa9147adca364ffee49ca112cd76d11515dbdceb366d8d4d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f627a696b6172736b792f67656c662d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bzikarsky/gelf-php/)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/5e294d3f2407d2ba2f157addffd74b913d256a7a2c82f6a6ef8cdd7f27152e21/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f627a696b6172736b792f67656c662d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bzikarsky/gelf-php/)[![Dependency Status](https://camo.githubusercontent.com/17dd1d85b91036b5b4316c9152e7bb271f4fc02951c4c9a397acda94fd1f4383/68747470733a2f2f696d672e736869656c64732e696f2f76657273696f6e6579652f642f7068702f677261796c6f67323a67656c662d7068702e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/52591e23632bac78d0000047)

A php implementation to send log-files to a gelf compatible backend like [Graylog2](http://graylog2.org/). This library conforms to the PSR standards in regards to structure ([4](http://www.php-fig.org/psr/psr-4/)), coding-style ([1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)) and logging ([3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)).

It's a loosely based on the original [Graylog2 gelf-php](https://github.com/Graylog2/gelf-php)and [mlehner's fork](https://github.com/mlehner/gelf-php).

Stable release and deprecation of the original graylog2/gelf-php
----------------------------------------------------------------

[](#stable-release-and-deprecation-of-the-original-graylog2gelf-php)

This implementation became the official PHP GELF library on 2013-12-19 and is now released as `graylog2/gelf-php`. The old library became deprecated at the same time and it's recommended to upgrade.

Since the deprecated library never got a stable release, we decided keep it available as `v0.1`. This means: If you have a project based on the deprecated library but no time to upgrade to version 1.0, we recommend to change your `composer.json` as following:

```
    "require": {
       // ...
       "graylog2/gelf-php": "0.1.*"
       // ...
    }

```

After running an additional `composer update` everything should work as expected.

Usage
-----

[](#usage)

### Recommended installation via composer:

[](#recommended-installation-via-composer)

Add gelf-php to `composer.json` either by running `composer require graylog2/gelf-php` or by defining it manually:

```
"require": {
   // ...
   "graylog2/gelf-php": "~1.5"
   // ...
}

```

Reinstall dependencies: `composer install`

### Examples

[](#examples)

For usage examples, go to [/examples](https://github.com/bzikarsky/gelf-php/tree/master/examples).

HHVM
----

[](#hhvm)

While HHVM is supported/tested, there are some restrictions to look out for:

- Stream-context support is very limited (as of 2014) - especially regarding SSL - many use-cases might not work as expected (or not at all...)
- `fwrite` does behave a little different

The failing unit-tests are skipped by default when running on HHVM. They are also all annotated with `@group hhvm-failures`. You can force to run those failures by setting `FORCE_HHVM_TESTS=1` in the environment. Therefore you can specifically check the state of HHVM failures by running:

```
FORCE_HHVM_TESTS=1 hhvm vendor/bin/phpunit --group hhvm-failures

```

License
-------

[](#license)

The library is licensed under the MIT license. For details check out the LICENSE file.

Development &amp; Contributing
------------------------------

[](#development--contributing)

You are welcome to modify, extend and bugfix all you like. :-) If you have any questions/proposals/etc. you can contact me on Twitter ([@bzikarsky](https://twitter.com/bzikarsky)) or message me on freenode#graylog2.

### Tools

[](#tools)

1. [composer](http://getcomposer.org), preferably a system-wide installation as `composer`
2. [PHPUnit](http://phpunit.de/manual/current/en/installation.html)
3. Optional: [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for PSR-X-compatibility checks

### Steps

[](#steps)

1. Clone repository and cd into it: `git clone git@github.com:bzikarsky/gelf-php && cd gelf-php`
2. Install dependencies: `composer install`
3. Run unit-tests: `vendor/bin/phpunit`
4. Check PSR compatibility: `vendor/bin/phpcs --standard=PSR2 src tests examples`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor5

5 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 ~67 days

Recently: every ~138 days

Total

25

Last Release

2908d ago

Major Versions

0.1.x-dev → 1.0.02013-12-19

PHP version history (3 changes)1.0.0PHP ~5.3

1.1.2PHP &gt;=5.3

1.2.1PHP &gt;=5.3.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/797553ab4740e78d80571f66be4bf6a5fcfccc620a6daa4943f3d25635c9d971?d=identicon)[elementary](/maintainers/elementary)

---

Top Contributors

[![steffkes](https://avatars.githubusercontent.com/u/325361?v=4)](https://github.com/steffkes "steffkes (5 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (4 commits)")[![evaldaskocys](https://avatars.githubusercontent.com/u/8693654?v=4)](https://github.com/evaldaskocys "evaldaskocys (3 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (3 commits)")[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (3 commits)")[![mrjgreen](https://avatars.githubusercontent.com/u/2183391?v=4)](https://github.com/mrjgreen "mrjgreen (2 commits)")[![pascalwild](https://avatars.githubusercontent.com/u/14974414?v=4)](https://github.com/pascalwild "pascalwild (2 commits)")[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (2 commits)")[![olegpro](https://avatars.githubusercontent.com/u/1092443?v=4)](https://github.com/olegpro "olegpro (1 commits)")[![Tobion](https://avatars.githubusercontent.com/u/610090?v=4)](https://github.com/Tobion "Tobion (1 commits)")[![afoeder](https://avatars.githubusercontent.com/u/1125168?v=4)](https://github.com/afoeder "afoeder (1 commits)")[![vendelev](https://avatars.githubusercontent.com/u/9020408?v=4)](https://github.com/vendelev "vendelev (1 commits)")[![betweenbrain](https://avatars.githubusercontent.com/u/634119?v=4)](https://github.com/betweenbrain "betweenbrain (1 commits)")[![chrisminett](https://avatars.githubusercontent.com/u/1084019?v=4)](https://github.com/chrisminett "chrisminett (1 commits)")[![chrisnew](https://avatars.githubusercontent.com/u/994286?v=4)](https://github.com/chrisnew "chrisnew (1 commits)")[![Cosmologist](https://avatars.githubusercontent.com/u/966525?v=4)](https://github.com/Cosmologist "Cosmologist (1 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (1 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (1 commits)")[![jacobkiers](https://avatars.githubusercontent.com/u/402504?v=4)](https://github.com/jacobkiers "jacobkiers (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/elementary-gelf-php/health.svg)

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

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M518](/packages/illuminate-log)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[pagemachine/typo3-formlog

Form log for TYPO3

23225.3k6](/packages/pagemachine-typo3-formlog)

PHPackages © 2026

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