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

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

mindscape/raygun4php
====================

Raygun.com client for sending errors and exceptions automatically.

v2.3.3(2y ago)371.5M↓11%3314MITPHPPHP ^7.2|^8.0

Since Oct 23Pushed 1y ago25 watchersCompare

[ Source](https://github.com/MindscapeHQ/raygun4php)[ Packagist](https://packagist.org/packages/mindscape/raygun4php)[ Docs](https://raygun.com)[ RSS](/packages/mindscape-raygun4php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (43)Used By (14)

Raygun4PHP
==========

[](#raygun4php)

[Raygun.com](http://raygun.com) provider for PHP 7.2+

*See [v1.8 documentation](https://github.com/MindscapeHQ/raygun4php/blob/1.8/README.md) for PHP v5.3+ support*

[![Build status](https://github.com/MindscapeHQ/raygun4php/actions/workflows/php.yml/badge.svg)](https://github.com/MindscapeHQ/raygun4php/actions/workflows/php.yml)

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

[](#installation)

Raygun4PHP uses [Guzzle](http://docs.guzzlephp.org/) to handle the transmission of data to the Raygun API. Having cURL installed is recommended, but is not required, as Guzzle will use a PHP stream wrapper if cURL is not installed.

### 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.

2\. Inside your project's root directory create a composer.json file, containing:

```
{
    "require": {
        "mindscape/raygun4php": "^2.0"
    }
}
```

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.

Usage
-----

[](#usage)

You can automatically send both PHP errors and object-oriented exceptions to Raygun. The RaygunClient requires an HTTP transport (e.g. Guzzle or other [PSR-7](https://www.php-fig.org/psr/psr-7/) compatible interface).

There are Guzzle-based asynchronous and synchronous transport classes in the provider, or you can use your own.

### Asynchronous transport

[](#asynchronous-transport)

This is an example of basic usage for asynchronous sending of errors and exceptions:

```
