2017 © Pedro Peláez
 

library snitcher

Simple API client for Dead Man's Snitch

image

webcore/snitcher

Simple API client for Dead Man's Snitch

  • Thursday, June 9, 2016
  • by chimneysweep13
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PHP Snitcher

Simple API client for Dead Man's Snitch inspired by official Ruby client, (*1)

Dependency Status license, (*2)

Install

Via Composer, (*3)

composer require webcore/snitcher

Snitcher depends on HTTPlug HTTP client abstraction for PHP. You can read more about HTTPlug framework integration with Symfony bundle in HTTPlug docs., (*4)

Usage

Example with Guzzle HTTP client

Install dependencies: - Implementation of HttpClient adapter using Guzzle, (*5)

```
composer require php-http/guzzle6-adapter
```

- Implementations of MessageFactory, StreamFactory and UriFactory, (*6)

```
composer require php-http/message
```

Create required factories:, (*7)

use Http\Adapter\Guzzle6\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Http\Message\StreamFactory\GuzzleStreamFactory;
use Http\Message\UriFactory\GuzzleUriFactory;

$httpClient = new Client(new GuzzleHttp\Client());
$messageFactory = new GuzzleMessageFactory();
$streamFactory = new GuzzleStreamFactory();
$uriFactory = new GuzzleUriFactory();

Create Snitcher instance:, (*8)

use Webcore\Snitcher\Snitcher;
$snitcher = new Snitcher($httpClient, $messageFactory, $streamFactory, $uriFactory);

To check in for one of your snitches:, (*9)

$snitcher->snitch("c2354d53d2");

You also may provide a message with the check in:, (*10)

$snitcher->snitch("c2354d53d2", "Finished in 23.8 seconds.")

If error occurs one of these exceptions is thrown:, (*11)

InvalidArgumentException
HttpClientException
Exception
 ```

## Sample composer.json:

{ "name": "some-user/nice-project", "require": { "webcore/snitcher": "^1.0.0", "php-http/guzzle6-adapter": "^1.1.1", "php-http/message": "^1.2.0" } } ```, (*12)

TODO

MIT license

Copyright (c) 2016, Štefan Peťovský, (*13)

The Versions

09/06 2016

dev-master

9999999-dev

Simple API client for Dead Man's Snitch

  Sources   Download

MIT

The Requires

 

by Štefan Peťovský

09/06 2016

v0.1.0

0.1.0.0

Simple API client for Dead Man's Snitch

  Sources   Download

MIT

The Requires

 

by Štefan Peťovský