dev-master
9999999-dev https://github.com/ss89/php-errormator-clienterrormator.com client library
BSD
The Requires
- php >=5.3.0
by Marcin Lulek
by Sebastian Struß
error errormator
errormator.com client library
PHP Client for errormator.com - helps you track errors in your web and cli apps, (*1)
you can easily add the php-errormator-client to your php app by doing the following:, (*2)
require 'ErrormatorClient\ErrormatorClient.php'; $opts = array("apiKey" => $api_key); // where $api_key == YOUR API KEY $client = new ErrormatorClient\ErrormatorClient($opts);
If you want to send a slow report, the data structure looks like:, (*3)
$data = array( array( "url" => "http://127.0.0.1/errormator-test", "server" => "127.0.0.1", "report_details" => array( array( "start_time" => date("Y-m-d\TH:i:s.u"), "end_time" => date("Y-m-d\TH:i:s.u"), "username" => "myUserName", "url" => "http://127.0.0.1/errormator-test-url", "ip" => "127.0.0.1", "user_agent" => "Firefox 1", "message" => "my custom message", "request" => array("field1" => "value1", "field2" => "value2"), "slow_calls" => array( array( "duration" => "11.1234", "timestamp" => date("Y-m-d\TH:i:s.u"), "type" => "sql", "subtype" => "mysql", "parameters" => array("param1", "param2", "param3"), "statement" => "select * from mytable" ) ) ) ) ) ); $client->slow($data);
keep in mind, that you can always post more than just one report with one request, just add another array into the first array., (*4)
If you want to send an error report, the data structure looks like:, (*5)
$data = array( array( "traceback" => "my traceback as string", "priority" => 1, "error_type" => "OMG ValueError happened", "occurences" => 2, "http_status" => 500, "errormator.client" => "php", "errormator.client" => "php", "server" => "127.0.0.1", "report_details" => array( array( "start_time" => date("Y-m-d\TH:i:s.u"), "username" => "myUserName", "url" => "http://127.0.0.1/errormator-test-url", "ip" => "127.0.0.1", "user_agent" => "Firefox blah", "message" => "my custom message", "request" => array( "REQUEST_METHOD" => "GET", "PATH_INFO" => "/FOO/BAR", "POST" => array( "field1" => "value1" ) ), ) ) ) ); $client->error($data);
and ofcourse the same rule applies here for sending more than just one report, you add another array in the first array, (*6)
If you want to send a log, the data structure looks like:, (*7)
$data = array( array( "log_level" => "INFO", "message" => "OMG ValueINFO happened", "name" => "php.namespace.indicator", "server" => "127.0.0.1", ), array( "log_level" => "WARN", "message" => "OMG ValueWARN happened", "name" => "php.namespace.indicator", "server" => "127.0.0.1", ), array( "log_level" => "ERROR", "message" => "OMG ValueERROR happened", "name" => "php.namespace.indicator", "server" => "127.0.0.1", ) ); $client->log($data);
here you already see how you send more than 1 log, (*8)
Using cakePHP? Try my AppError and AppLog class for the php-errormator-client in the subfolder cakePHP. Here is how to set it up cakePHP set up errorhandlers, (*9)
Using no Framework? You're welcome too to look at noFramework\example.php and noFramework\example2.php :), (*10)
errormator.com client library
BSD
error errormator