onezero/laas

There is no license information available for the latest version (1.1.2) of this package.

Laravel package for integrating the LAAS API

1.1.2 2024-02-27 11:55 UTC

This package is auto-updated.

Last update: 2024-11-27 13:42:58 UTC


README

Installation

composer require onezero/laas

Usage

To use the SDK, set your LAAS_TOKEN in your .env file. You can get this from the LAAS dashboard.

LAAS_TOKEN=your-app-token

For Laravel v9^, the package will automatically register the service provider and facade.

For Laravel v8^, add the service provider and facade to your config/app.php file.

// config/app.php
'providers' => [
    ...,
    OneZero\Laas\LaasServiceProvider::class,
],
use OneZero\Laas\Laas;
...
$laas = new Laas();

$laas->error('Something went wrong', context: [
    'user' => 'John Doe',
    'email' => 'johndoe@example.com',
]);

or use the Facade

use OneZero\Laas\Facades\Laas;

Laas::error('Something went wrong', context: [
    'user' => 'John Doe',
    'email' => '',
]);

// OR use the function helper

laas()->error('Something went wrong', context: [
    'user' => 'John Doe',
    'email' => '',
]);

Log Levels

All the basic laravel log levels are available and an added critical and warning level. Just for vibes.

laas()->debug('Debug message');
laas()->info('Info message');
laas()->error('Error message');
laas()->emergency('Emergency message');

// Bonus
laas()->warning('Warning message');
laas()->critical('Critical message');