PHP code example of ontherocksoftware / laravelredambergreen

1. Go to this page and download the library: Download ontherocksoftware/laravelredambergreen 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/ */

    

ontherocksoftware / laravelredambergreen example snippets


return [

    /**
     * Your API token. Obtain from your account at https://app.red-amber.green/
     */
    'token' => env('RAG_API_TOKEN','YOUR_TOKEN'),

    /**
     * If you prefer to use the service without exceptions, set this to false
     */

     'exceptions' => env('RAG_WITH_EXCEPTIONS',true)

];

use Ontherocksoftware\LaravelRedAmberGreen\Facades\LaravelRedAmberGreen;

/**
 * Assuming you added a monitor to your account named 'Stock Levels' you can interact with that monitor 
 * using the static methods provided:
 */ 


//Your code here to check stock levels....

//If all good just set to green
LaravelRedAmberGreen::green('Stock Levels');

//If you want to provide additional info you can pass a short message and a link to more in depth info
LaravelRedAmberGreen::amber('Stock Levels', 'Stock levels dropped significantly in the last 24 hours', 'https://www.mysystem.com/dashboard/stocklevels');

//And of course if things are already really bad use the red method
LaravelRedAmberGreen::red('Stock Levels', 'We ran out of stock for some products', 'https://www.mysystem.com/dashboard/outofstock');

bash
php artisan vendor:publish --provider="Ontherocksoftware\LaravelRedAmberGreen\LaravelRedAmberGreenServiceProvider"