Download the PHP package alfred-nutile-inc/incomings-client without Composer

On this page you can find all versions of the php package alfred-nutile-inc/incomings-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package incomings-client

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

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

logo

Sign up for the service https://incomings.io

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

watching

Docs below and at https://incomings.io/help

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

Laravel 5.6

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

Send Data to the Service

URL

This is the most simple helper. Each project gets one

@TODO fix broken image need to find the right one url

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

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 https://laravel.com/docs/5.2/queues

For example I can register with my AppServiceProvider

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

    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

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

Before

After

If you are using Lumen, you will need to use the IncomingsExceptionHandlerForLumen instead, like so:

Then as seen in this route it will send a message first to Incomings.io

Will send a message like

Bugsnag Too

If you are using a service like BugSnag just follow their directions so your app/Exceptions/Handler.php would then look like this.

Filter for Laravel 4.2

As above plug in your provider

If you are not using DotEnv as I write about here https://alfrednutile.info/posts/113

Then update your .env.php to have your tokens and url

<?php

return array(
    'INCOMINGS_URL' => 'https://post.incomings.io',
    'INCOMINGS_TOKEN' => 'foo-bar-foo'
);

Then in your route

Route::get('/', ['before' => 'incomings', function()
{
    return View::make('hello');
}]);

Finally in your filter file add the following app/filters.php


Route::filter('incomings', function() {

    try
    {
        $incomings = new \AlfredNutileInc\Incomings\IncomingsFilter();
        $incomings->handle(\Illuminate\Support\Facades\Request::instance());
    }
    catch(\Exception $e)
    {
        Log::error(sprintf("Error with Incomings :( %s", $e->getMessage());
    }

});

This will catch any issues and not mess up your application.

incomings

Curl

Here is an example of using Curl. In this case I want to see some info from my server every hour.

curl -k -H "Content-Type: application/json" -H "Accept: application/json" -X POST --data @status.json https://post.incomings.io/incomings/f4ac705d-5087-3432-8182-334de6726fc5

Then every hour I get to see the updates to that file. The CronJob would run this as root

01 * * * * apt-get upgrade -s | grep -i security > /tmp/status.json
03 * * * * curl -k -H "Content-Type: application/json" -H "Accept: application/json" -X POST --data @/tmp/status.json https://post.incomings.io/incomings/foobar

You can even make a bach command to run this all and gather more data like "Last Run" etc.

Drupal 8

Coming Soon...

Drupal 7

Coming Soon...


All versions of incomings-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
guzzlehttp/guzzle Version ~5.3|~6.0
monolog/monolog Version ^1.23
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alfred-nutile-inc/incomings-client contains the following files

Loading the files please wait ....