Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

a bit more and clearer documentation

  • Loading branch information...
commit da01997c660cc9a99169852a069771be85b6a6bc 1 parent d714f2d
@rich rich authored
Showing with 52 additions and 6 deletions.
  1. +10 −2 README.markdown
  2. +2 −1  Services/Hoptoad.php
  3. +40 −3 doc/example.php
View
12 README.markdown
@@ -2,6 +2,10 @@
This is a simple [Hoptoad](http://hoptoadapp.com) notifier for PHP. It's been used in a few production sites now with success. It's not quite as fully featured as the official Ruby notifier but it works well.
+# Thanks
+
+Big thanks to Lou Kosak and Till Klampaeckel who have both contributed extensively to this project.
+
# Limitations
This notifier does not contain two big features from the Ruby notifier. The two are error filtering and deploy tracking. Error filtering will be coming in a future release.
@@ -10,10 +14,14 @@ For deploy tracking, since I use Capistrano to deploy my PHP apps, I simply use
# Requirements
-Install Pear's HTTP_Request2:
+To use the default _pear_ client install Pear's HTTP_Request2:
pear install HTTP_Request2
-
+
+To use the _curl_ client, install the PHP curl extension. To install on Ubuntu if you are using PHP 5 you would run:
+ sudo apt-get install php5-curl
+ sudo /etc/init.d/apache2 reload
+
# License
Copyright (c) 2010, Rich Cavanaugh
View
3  Services/Hoptoad.php
@@ -66,10 +66,11 @@ class Services_Hoptoad
* @return void
* @author Rich Cavanaugh
*/
- public static function installHandlers($api_key=NULL, $environment=NULL)
+ public static function installHandlers($api_key=NULL, $environment=NULL, $client=NULL)
{
if (isset($api_key)) self::$apiKey = $api_key;
if (isset($environment)) self::$environment = $environment;
+ if (isset($client)) self::$client = $client;
set_error_handler(array("Services_Hoptoad", "errorHandler"));
set_exception_handler(array("Services_Hoptoad", "exceptionHandler"));
View
43 doc/example.php
@@ -1,4 +1,41 @@
<?php
- require_once('Hoptoad.php');
-
- Hoptoad::installHandlers("YOUR_HOPTOAD_API_KEY", 'production');
+// register Services_Hoptoad for php errors and raised exceptions
+require_once 'Services/Hoptoad.php';
+Services_Hoptoad::installHandlers("YOUR_HOPTOAD_API_KEY");
+?>
+
+<?php
+// register Services_Hoptoad for php errors and raised exceptions
+// when used in your staging environment
+require_once 'Services/Hoptoad.php';
+Services_Hoptoad::installHandlers("YOUR_HOPTOAD_API_KEY", 'staging');
+?>
+
+<?php
+// register Services_Hoptoad for php errors and raised exceptions
+// when used in production and using the Curl transport
+require_once 'Services/Hoptoad.php';
+Services_Hoptoad::installHandlers("YOUR_HOPTOAD_API_KEY", 'production', 'curl');
+?>
+
+<?php
+// standalone
+require_once 'Services/Hoptoad.php';
+
+Services_Hoptoad::$apiKey = "YOUR_HOPTOAD_API_KEY";
+
+$exception = new Custom_Exception('foobar');
+Services_Hoptoad::handleException($exception);
+?>
+
+<?php
+// use Zend_Http_Client
+require_once 'Services/Hoptoad.php';
+
+Services_Hoptoad::$apiKey = "YOUR_HOPTOAD_API_KEY";
+Services_Hoptoad::$client = "zend";
+
+$exception = new Custom_Exception('foobar');
+Services_Hoptoad::handleException($exception);
+?>
+
Please sign in to comment.
Something went wrong with that request. Please try again.