peteradeojo / laas-php-sdk
A PHP SDK for the LAAS API
v2.2.1
2023-08-01 03:14 UTC
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.7
Requires (Dev)
- brianium/paratest: ^7.1
- phpunit/phpunit: ^10.2
- vlucas/phpdotenv: ^5.5
README
Laas is a PHP package for sending logs to the LAAS API.
Installation
You can install Laas using Composer:
composer require peteradeojo/laas
Usage
First, you need to create an instance of the Laas
class:
$laas = Laas::getInstance();
Then, you can use the sendLog
method to send a log to the LAAS API:
$log = new LaasLogDTO(); $log->level = 'info'; $log->message = 'This is a test message'; $response = $laas->sendLog($log);
The sendLog
method returns a Guzzle HTTP response, which you can use to check the status code and response body (or you can completely ignore it).
How to get the LAAS_APP_TOKEN
To get the app token you will need to
- visit Lags
- Create an account on the platform
- Log in to the account you just created
- Create an app from your dashboard and put in the name for the app e.g Hotel system
- click on generate token
- copy the token generated and use it in your application.
Note: Make sure to set the LAAS_APP_TOKEN
environment key before using the sendLog
method.
Contributing
Contributions are welcome! If you find a bug or want to add a new feature, please open an issue or submit a pull request.
License
Laas is open-source software licensed under the MIT license.