synergitech/cronitor-laravel

15,529
Install
composer require synergitech/cronitor-laravel
Latest Version:v1.0.0
License:MIT
Last Updated:Sep 19, 2024
Links: GitHub  ·  Packagist
Maintainer: SynergiTech

cronitor-laravel

Tests

Install

composer require "synergitech/cronitor-laravel"

Version compatibility

  • Laravel 6.x-8.x
  • PHP 7.3-7.4, 8.0

Configuration

php artisan vendor:publish --provider="SynergiTech\Cronitor\Laravel\CronitorServiceProvider"

Usage

Automatically monitoring a Job

Your Jobs can be automatically monitored by this package by implementing the HasCronitorKey contract.

use SynergiTech\Cronitor\Laravel\Contracts\HasCronitorKey;

class YourJob implements HasCronitorKey
{
    public function getMonitorKey(): string
    {
        return 'your monitor key from cronitor.io';
    }
}

When your Job is dispatched, a Dispatcher middleware will automatically send telemetry events based on whether your job is successful.

Monitoring arbitrary code

Additionally, you can monitor any callback via the Cronitor facade:

use SynergiTech\Cronitor\Laravel\Facades\Cronitor;

class YourClass
{
    public function handle()
    {
        Cronitor::monitorJob('your monitor key', function () {
            throw new \Exception('This will automatically be reported as a fail event');
        });
    }
}

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released Laravel License
v1.0.0 ^9.0|^10.0|^11.0 MIT
v0.2.1 ^6.0|^7.0|^8.0 MIT
v0.2.0 ^6.0|^7.0|^8.0 MIT
v0.1.0 ^6.0|^7.0|^8.0 MIT