PHP code example of preprio / opsgenie

1. Go to this page and download the library: Download preprio/opsgenie library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

preprio / opsgenie example snippets


Ops()->incident()

Ops()->alert()

->message('Import failed')

->description('Import failed')

->description([
        'environment' => 'xxx-xxx-xxx',
        'file' => 'xxx_x_xxxx_xxxx_xx.csv'
        'example' => true
    ])

->tags(['critical', 'import', 'micro-service'])

->send();

Ops()
    ->incident()
    ->critical()
    ->message('Import failed')
    ->description('The import script failed to import data from customer X.')
    ->details([
        'environment' => 'xxx-xxx-xxx',
        'file' => 'xxx_x_xxxx_xxxx_xx.csv'
        'example' => true
    ])
    ->tags(['critical', 'import', 'micro-service'])
    ->send();

Ops()
    ...
    ->send()
    ->attachBlob('RESOURCE/BLOB', 'filename_with.extension');

Ops()
    ...
    ->send()
    ->attachBlob('RESOURCE/BLOB', 'filename_with.extension')
    ->attachBlob('<html><body><h1>Hello World!</h1></body></html', 'index.html');
    ->attachBlob('{"Hello":"World"}', 'export.json');

Ops()
    ...
    ->send()
    ->attachFile('/path/to/file');

Ops()
    ...
    ->send()
    ->attachBlob('{"Hello":"World"}', 'export.json')
    ->attachFile('/path/to/file')
    ->attachBlob('<html><body><h1>Hello World!</h1></body></html', 'index.html');

php artisan vendor:publish --provider="Prepr\OpsGenie\OpsGenieServiceProvider"