2017 © Pedro Peláez
 

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

image

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.

  • Monday, March 3, 2014
  • by MeadSteve
  • Repository
  • 0 Watchers
  • 0 Stars
  • 4 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Raygun4php

This is a fork of the official ray gun client for php found here: 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., (*1)

Installation

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

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., (*3)

  1. If you use a *nix environment, follow the instructions to install Composer. Windows users can run this installer to automatically add it to the path etc., (*4)

  2. Inside your project's root directory create a composer.json file, containing:, (*5)

{
        "require": {
            "mead-steve/raygun4php": "1.*"
        }
}
  1. From your shell run php composer.phar install (*nix) or composer install (Windows). This will download Raygun4Php and create the appropriate autoload data., (*6)

  2. Then in a PHP file just add:, (*7)

require_once 'vendor/autoload.php';

and the library will be imported ready for use., (*8)

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()., (*9)

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

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., (*10)

Then, create handlers that look something like this:, (*11)

    $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)., (*12)

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., (*13)

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., (*14)

User tracking

You can call $client->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->SetUser() to assign a new random identifier)., (*15)

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., (*16)

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

Troubleshooting

SendError and SendException return the HTTP status code of the transaction - echoing this will give you a 403 if your API key is incorrect or a 200 if everything was a success., (*18)

The Versions

03/03 2014

v0.2.0

0.2.0.0 http://raygun.io

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.

  Sources   Download

MIT

The Requires

 

The Development Requires

logging errors exceptions raygun

03/03 2014

dev-master

9999999-dev http://raygun.io

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.

  Sources   Download

MIT

The Requires

 

The Development Requires

logging errors exceptions raygun

03/03 2014

dev-forking-work

dev-forking-work http://raygun.io

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.

  Sources   Download

MIT

The Requires

 

The Development Requires

logging errors exceptions raygun

03/03 2014

v0.0.1

0.0.1.0 http://raygun.io

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.

  Sources   Download

MIT

The Requires

 

The Development Requires

logging errors exceptions raygun

03/03 2014

v0.1.0

0.1.0.0 http://raygun.io

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.

  Sources   Download

MIT

The Requires

 

The Development Requires

logging errors exceptions raygun

12/11 2013

dev-restructure

dev-restructure http://raygun.io

Raygun.io client for PHP 5.3, to send errors and exceptions automatically.

  Sources   Download

MIT

The Requires

 

logging errors exceptions raygun

12/11 2013

dev-composer-packagist

dev-composer-packagist http://raygun.io

Fork and extension of the official Raygun.io client for PHP. Implements some extra communication options. Provides message builders and senders to allow composition of new clients.

  Sources   Download

MIT

The Requires

 

logging errors exceptions raygun

12/11 2013

dev-send-on-destruct

dev-send-on-destruct http://raygun.io

Raygun.io client for PHP 5.3, to send errors and exceptions automatically.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

logging errors exceptions raygun

01/11 2013

dev-tidy-up

dev-tidy-up http://raygun.io

Raygun.io client for PHP 5.3, to send errors and exceptions automatically.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

logging errors exceptions raygun

22/10 2013

dev-alternate-sending-function

dev-alternate-sending-function http://raygun.io

Raygun.io client for PHP 5.3, to send errors and exceptions automatically.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

logging errors exceptions raygun

03/04 2013

dev-LocalTime

dev-LocalTime http://raygun.io

Raygun.io client for PHP 5.3, to send errors and exceptions automatically.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

logging errors exceptions raygun

04/02 2013

dev-capture-loc

dev-capture-loc http://raygun.io

Raygun.io client for PHP 5.3, to send errors and exceptions automatically.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

logging errors exceptions raygun