PHPackages                             mead-steve/raygun4php - 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. mead-steve/raygun4php

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

mead-steve/raygun4php
=====================

This is a fork of the Raygun.io client for PHP 5.3, to send errors and exceptions automatically. Hopefully this fork will be a bit easier to write tests for and uses additional ways of sending messages to raygun.

v0.2.0(12y ago)014MITPHPPHP &gt;=5.3.0

Since Feb 3Pushed 12y ago1 watchersCompare

[ Source](https://github.com/meadsteve/raygun4php)[ Packagist](https://packagist.org/packages/mead-steve/raygun4php)[ Docs](http://raygun.io)[ RSS](/packages/mead-steve-raygun4php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

Raygun4php
==========

[](#raygun4php)

This is a fork of the official ray gun client for php found here: [MindscapeHQ/raygun4php](https://github.com/MindscapeHQ/raygun4php/). I am intending to keep interface of the Client object the same as for the official client so that it will be possible to switch back and forth.

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

[](#installation)

Firstly, ensure that **curl** is installed and enabled in your server's php.ini file.

### With Composer

[](#with-composer)

Composer is a package management tool for PHP which automatically fetches dependencies and also supports autoloading - this is a low-impact way to get Raygun4php into your site.

1. If you use a \*nix environment, [follow the instructions](http://getcomposer.org/doc/01-basic-usage.md#installation) to install Composer. Windows users can run [this installer](https://github.com/johnstevenson/composer-setup) to automatically add it to the path etc.
2. Inside your project's root directory create a composer.json file, containing:

```
{
        "require": {
            "mead-steve/raygun4php": "1.*"
        }
}
```

3. From your shell run `php composer.phar install` (\*nix) or `composer install` (Windows). This will download Raygun4Php and create the appropriate autoload data.
4. Then in a PHP file just add:

```
require_once 'vendor/autoload.php';
```

and the library will be imported ready for use.

### Manually with Git

[](#manually-with-git)

Clone this repository and copy src/Raygun4php into an appropriate subdirectory in your project, such as /vendor/Raygun4php. Add `requires` definitions for RaygunClient.php where you want to make a call to Send().

```
require (dirname(dirname(__FILE__)).'/vendor/Raygun4php/RaygunClient.php');
```

Usage
-----

[](#usage)

You can send both PHP errors and object-oriented exceptions to Raygun. An easy way to accomplish this is to create a file containing exception and error handlers which make calls to the appropriate Raygun4php functions. As above, import Raygun4php - if you're using Composer, just add `require_once 'vendor/autoload.php'`, or if not manually import RaygunClient.php.

Then, create handlers that look something like this:

```
	$client = \MeadSteve\Raygun4php\RayGun::getClient("{{apikey for your application}}");

	function error_handler($errno, $errstr, $errfile, $errline ) {
		global $client;
  		$client->SendError($errno, $errstr, $errfile, $errline);
	}

	function exception_handler($exception)
	{
		global $client;
		$client->SendException($exception);
	}

	set_exception_handler('exception_handler');
	set_error_handler("error_handler");
```

Copy your application's API key from the Raygun.io dashboard, and place it in the constructor call as above (do not include the curly brackets).

If the handlers reside in their own file, just import it in every file where you'd like exceptions and errors to be sent, and they will be delivered to Raygun.io.

#### Version numbers

[](#version-numbers)

You can transmit the version number of your PHP project along with the message by calling `SetVersion()` on your RaygunClient after it is instantiated - this is optional but recommended as the version number is considered to be first-class data for a message.

#### User tracking

[](#user-tracking)

You can call $client-&gt;SetUser($user), passing in a string representing the username or email address of the current user of the calling application. This will be attached to the message and visible in the dashboard. This method is optional - if it is not called, a random identifier will be used. If you use this, and the user changes (log in/out), be sure to call it again passing in the new user (or just call $client-&gt;SetUser() to assign a new random identifier).

Note that this data is stored as a cookie. If you do not call SetUser the default is to store a random UUID to represent the user.

This feature can be used in CLI mode by calling SetUser(string) at the start of your session.

Troubleshooting
---------------

[](#troubleshooting)

SendError and SendException return the HTTP status code of the transaction - `echo`ing this will give you a 403 if your API key is incorrect or a 200 if everything was a success.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.3% 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 ~0 days

Total

3

Last Release

4455d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f6a1fc7be44918da7cc299d340d1e27b338e2396c2f2ca389857b4e2e197c4b?d=identicon)[MeadSteve](/maintainers/MeadSteve)

---

Top Contributors

[![fundead](https://avatars.githubusercontent.com/u/1237740?v=4)](https://github.com/fundead "fundead (17 commits)")[![caseycs](https://avatars.githubusercontent.com/u/76095?v=4)](https://github.com/caseycs "caseycs (3 commits)")[![CmdrKeen](https://avatars.githubusercontent.com/u/2560263?v=4)](https://github.com/CmdrKeen "CmdrKeen (1 commits)")[![mrardon](https://avatars.githubusercontent.com/u/634533?v=4)](https://github.com/mrardon "mrardon (1 commits)")

---

Tags

loggingerrorsexceptionsraygun

### Embed Badge

![Health badge](/badges/mead-steve-raygun4php/health.svg)

```
[![Health](https://phpackages.com/badges/mead-steve-raygun4php/health.svg)](https://phpackages.com/packages/mead-steve-raygun4php)
```

###  Alternatives

[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90234.6M36](/packages/bugsnag-bugsnag-laravel)[bugsnag/bugsnag

Official Bugsnag notifier for PHP applications.

56347.0M78](/packages/bugsnag-bugsnag)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[mindscape/raygun4php

Raygun.com client for sending errors and exceptions automatically.

371.5M14](/packages/mindscape-raygun4php)[bugsnag/bugsnag-symfony

Official BugSnag notifier for Symfony applications.

453.0M3](/packages/bugsnag-bugsnag-symfony)

PHPackages © 2026

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