PHP code example of consigliere / signal

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

    

consigliere / signal example snippets


event('signal.emergency', [$message]);
event('signal.alert', [$message,]);
event('signal.critical', [$message]);
event('signal.error', [$message]);
event('signal.warning', [$message]);
event('signal.notice', [$message]);
event('signal.info', [$message]);
event('signal.debug', [$message]);

use Illuminate\Support\Facades\Event;

Event::dispatch('signal.emergency', [$message]);
Event::dispatch('signal.alert', [$message]);
Event::dispatch('signal.critical', [$message]);
Event::dispatch('signal.error', [$message]);
Event::dispatch('signal.warning', [$message]);
Event::dispatch('signal.notice', [$message]);
Event::dispatch('signal.info', [$message]);
Event::dispatch('signal.debug', [$message]);

$this->fireLog('emergency', $message);
$this->fireLog('alert', $message);
$this->fireLog('critical', $message);
$this->fireLog('error', $message);
$this->fireLog('warning', $message);
$this->fireLog('notice', $message);
$this->fireLog('info', $message);
$this->fireLog('debug', $message);

use App\Components\Signal\Traits\Signal;

class UserController extends Controller
{
    use Signal;

    public function browse(Request $request): \Illuminate\Http\JsonResponse
    {
        $data   = [];
        $option = $this->getOption();
        $param  = $this->getParam($this->type);

        try {
            $user = $this->userService->profile($data, $option, $param);
        } catch (\Exception $error) {
            # Provide $error instance of \Exception
            # Provide the uuid, upon empty, error uuid will be assigned automatically
            $this->fireLog('error', $error->getMessage(), ['error' => $error, 'uuid' => $this->euuid]);

            return $this->response($this->getErrorResponse($this->euuid, $error), 500);
        }

        return $this->response($user, 200);
    }
}
bash
php artisan vendor:publish --tag=migrations-signal
php artisan migrate
bash
php artisan vendor:publish --tag=config-signal