PHPackages                             alfred-nutile-inc/incomings-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. alfred-nutile-inc/incomings-client

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

alfred-nutile-inc/incomings-client
==================================

Connects to incomings.io

v2.0.2(8y ago)523.2k1[2 issues](https://github.com/alfred-nutile-inc/incomings-client/issues)PHPPHP &gt;=5.6.0

Since Jun 26Pushed 7y ago13 watchersCompare

[ Source](https://github.com/alfred-nutile-inc/incomings-client)[ Packagist](https://packagist.org/packages/alfred-nutile-inc/incomings-client)[ RSS](/packages/alfred-nutile-inc-incomings-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (14)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/006ca003776d2df7f69c7cc1072afa18bcbfcb856ee4bd0fe692f4392f1f5fd6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c667265642d6e7574696c652d696e632f696e636f6d696e67732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alfred-nutile-inc/incomings-client)[![Build Status](https://camo.githubusercontent.com/ec3475beb5994585c3827ded62a67b9fb35cbc385742c5b804b928b5fd9e51d3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616c667265642d6e7574696c652d696e632f696e636f6d696e67732d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/alfred-nutile-inc/incomings-client)[![Coverage Status](https://camo.githubusercontent.com/b7e02b6e723ab8fff90563f86d432ef6b3f0e4b0c407aff72a1803d7965a97c1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f616c667265642d6e7574696c652d696e632f696e636f6d696e67732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/alfred-nutile-inc/incomings-client/code-structure)[![Quality Score](https://camo.githubusercontent.com/c0a8e8568b58ee887c89fa59244e2584b68b30c917b31103588be9c7027f3e42/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616c667265642d6e7574696c652d696e632f696e636f6d696e67732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/alfred-nutile-inc/incomings-client)[![Total Downloads](https://camo.githubusercontent.com/db7ffa8a7630a744225f49d9b00163eaefd2068d8d95d2fa2bd2189d378ef7de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c667265642d6e7574696c652d696e632f696e636f6d696e67732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alfred-nutile-inc/incomings-client)

Laravel and Non-Laravel Library To Connect to Incomings.io Service
==================================================================

[](#laravel-and-non-laravel-library-to-connect-to-incomingsio-service)

[![logo](https://camo.githubusercontent.com/88226bedd563d8a94fd112988fe4d129b554773ddec44d41f553c5a42cc0d604/68747470733a2f2f696e636f6d696e67732e696f2f696d616765732f6c6f676f5f776964652e6a706567)](https://camo.githubusercontent.com/88226bedd563d8a94fd112988fe4d129b554773ddec44d41f553c5a42cc0d604/68747470733a2f2f696e636f6d696e67732e696f2f696d616765732f6c6f676f5f776964652e6a706567)

Sign up for the service

Then setup and start watching your processes come in one place instead of 5 plus places!

[![watching](https://camo.githubusercontent.com/23ddef72cfd75d3f9eca21ddc1dc553577530aea301fab9770331865b1ddf643/68747470733a2f2f696e636f6d696e67732e696f2f696d616765732f616c6c5f7468655f706c616365732e706e67)](https://camo.githubusercontent.com/23ddef72cfd75d3f9eca21ddc1dc553577530aea301fab9770331865b1ddf643/68747470733a2f2f696e636f6d696e67732e696f2f696d616765732f616c6c5f7468655f706c616365732e706e67)

Docs below and at

Install
-------

[](#install)

Tested on Laravel 4.2 and 5.x more platforms to be tested soon.

Composer install

```
composer require alfred-nutile-inc/incomings-client:">=2.0"

```

Add to app.php

```
'AlfredNutileInc\Incomings\IncomingsServiceProvider',

```

NOTE: If you are using Lumen, instead of the above you need to enable the provider in bootstrap/app.php like this:

```
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/

$app->register('AlfredNutileInc\Incomings\IncomingsServiceProvider');

```

Set in your .env

```
INCOMINGS_URL=https://incomings.io

INCOMINGS_TOKEN=token_of_project

```

### Laravel 5.6

[](#laravel-56)

Add the `incomings` log channel to your `config/logging.php` file:

```
'channels' => [
    'stack' => [
        'driver' => 'stack',
        // Add incomings to the stack:
        'channels' => ['single', 'incomings'],
    ],

    'incomings' => [
        'driver' => 'incomings',
        'level' => 'debug',
    ],
],

```

Send Data to the Service
------------------------

[](#send-data-to-the-service)

### URL

[](#url)

This is the most simple helper. Each project gets one

> @TODO fix broken image need to find the right one [![url](https://camo.githubusercontent.com/092c27a65c52e3fc602576e345ceee57dae1819a7eb846caf0bc3a1e044f62a5/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f377477316367753577766c677a31302f53637265656e73686f74253230323031352d30362d323525323031392e32322e30342e706e673f646c3d30)](https://camo.githubusercontent.com/092c27a65c52e3fc602576e345ceee57dae1819a7eb846caf0bc3a1e044f62a5/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f377477316367753577766c677a31302f53637265656e73686f74253230323031352d30362d323525323031392e32322e30342e706e673f646c3d30)

So you can for example use that on Iron.io as a PUSH queue route since you can have more than one.

Or even on your server setup a cron job to post every minute your server resource status or security status.

Example Iron.io

[![iron](https://camo.githubusercontent.com/576e45a132ed727d700afb7dbb5b97398db69b80749d25ec5f888e6ba40823e6/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f683371346f6a63626d6732327473362f69726f6e5f6578616d706c652e706e673f646c3d30)](https://camo.githubusercontent.com/576e45a132ed727d700afb7dbb5b97398db69b80749d25ec5f888e6ba40823e6/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f683371346f6a63626d6732327473362f69726f6e5f6578616d706c652e706e673f646c3d30)

### Laravel Facade

[](#laravel-facade)

Say you are about to send off to a queue

```
Queue::push("foo", $data);

```

Now try

```
$data = ['title' => 'Foo Bar', 'message' => [1,2,3]]

Incomings::send($data);

Queue::push("foo", $data);

```

For the above Facade to work you might have to add

```
use AlfredNutileInc\Incomings\IncomingsFacade as Incomings;

```

NOTE: If you're using Lumen, make sure to enable facades in bootstrap/app.php with `$app->withFacades();`

Also see Laravel Docs for failed Queue

For example I can register with my `AppServiceProvider`

```

        Queue::failing(function (JobFailed $event) {
            $message = sprintf("Connection %s, Job %s, Exception %s %s %s",
                    $event->connectionName, implode("\n", $event->data), $event->job->getRawBody()
                );
            $data = ['title' => 'Failed Queue From FooBar', 'message' =>

                json_encode($message, JSON_PRETTY_PRINT)
            ];

            Incomings::send($data);
        });

```

### Logger

[](#logger)

This setup will allow you to use Log::info("Some Message") and all the other Log methods as normal.

All you need to do at the top of your Class is to set use as follow

```
use AlfredNutileInc\Incomings\Log;

```

From there on your log messages go to Incomings then to Logger

Even better you now can/should do this

```
    $send = [
        'title' => 'foo',
        'message' => "bar",
    ];
    Log::info($send);

```

The IncomingLogger will pass this array to Incomings.io giving your incoming more context and then it will just pass the message to Log as normal. So you could even do.

```
    $send = [
        'title' => 'foo',
        'message' => print_r($some_array_payload, 1),
    ];

```

Like sometimes we do in Log::info as we are watching for non string based info in the logs. Or

```
    $send = [
        'title' => 'foo',
        'message' => json_encode($some_array_payload, JSON_PRETTY_PRINT),
    ];

```

For nicer looking data.

### MiddleWare

[](#middleware)

```
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'incomings' => \AlfredNutileInc\Incomings\IncomingsMiddleWare::class
    ];

```

Then plug it in

```
Route::get('foobar', ['middleware' => 'incomings', function() {

    return "Send to incomings!";

}]);

```

Then data coming in via POST, GET, etc will be sent to Incomings for a sense of is the data coming into my system correctly etc.

You can pass a title as well

```
Route::get('foobar', ['middleware' => 'incomings:My Title', function() {

    return "Send to incomings!";

}]);

```

### Laravel Exceptions

[](#laravel-exceptions)

Just edit your `app/Exceptions/Handler.php` so it uses Incomings Exception handler

Before

```
