deniscosmin/logservice

A package to log data to server

v1.1 2024-07-28 22:22 UTC

This package is not auto-updated.

Last update: 2024-09-09 10:36:34 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Project setup

In the .env file you should add the fields :

API_CREDENTIALS_USER and API_CREDENTIALS_PASSWORD

These sould be set to the authentification credentials of the api. If these are misssing or are wrong written, the api will return the response Invalid authentification.

Installation

You can install the package via composer:

composer require deniscosmin/logservice

You can publish and run the migrations with:

php artisan vendor:publish --tag="logservice-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="logservice-config"

This is the contents of the published config file:

return [
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="logservice-views"

Usage

First option :

use Deniscosmin21\LogService\LogService;

$el = new LogService();

Second option :

use LogData;

LogData::set_source($request)->set_data('my log', 'info')->email(['test@gmail.com', 'test2@gmail.com'])->phone('07....')->send();

The methods available : 1.

set_source(Request | string);

sets the source of the log for example logs.mezoni.ro

set_data(string $details, string $type = 'info')

sets the details of the log, and maybe the type if you want. Else the type will be info.

email(array $email_list)

contains an array of emails to which the log will be sent by email. example php['test1@test.com', 'test2@test.com'].

sms($phone_number)

sends the log to the phone number by sms

type($type = 'info')

sets the type of the log

send()

sends the data to the api and returns the response from the api

It can use any order but the last method used should be the send() method.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.