Download the PHP package oilytortoise/laravel-telemetry without Composer

On this page you can find all versions of the php package oilytortoise/laravel-telemetry. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-telemetry

laravel-telemetry

Integration between Laravel and Betterstack's Telemetry feature (for logging and metrics)
BetterStack: [https://betterstack.com/]

Basically, the documentation for setting up Telemetry with laravel recommends a method that requires instantiating and setting up the logger object every time you want to log something which, imo, is combersome and not very performant.

This package does not exclusively log to Telemetry. If the ENABLE_TELEMETRY environment variable is set to false the package will return to logging to the default Laravel log channel as configured in your logging.php config file.
This package is built to make the logging process much simpler and implement some other handy logging / debugging features.

Installation

Setup BetterStack

  1. Sign up for betterstack
  2. Go to the "Telemetry" tab
  3. Navigate to "Sources" and create a new source for a PHP app

Setup Laravel Application

This is a recommended setup - feel free to use the package however you like!

  1. publish the package's config file:


  1. In your AppServiceProvider add the following in the boot() function to create a singleton you can utilize throughout your application whenever you want to log an event:

note: The benefit of using a singleton is that your application will load the class only once when it is booted, then you can use that instance of the telemetry logger service instead of creating a new instance every time you want to log something. This reduces the development effort and makes the process more performant.

You may tag the singleton however you want. I use 'telemetry' in the example above but you could use 'log', or 'TelemetryLogger::class' or anything you want as long as it doesn't clash with another singleton in the app.

  1. In your .env file, add the following:


  1. To log an event you can use the logger as shown below:

The syntax for logging is essentially the same as the default \Illuminate\Support\Facades\Log service provided by Laravel. The same debug, info, notice, warning, error, critical, alert, emergency functions act as the log level. The first parameter passed in is the log message, the second parameter is the context array.

  1. To log exceptions to telemetry, there are two options:
    To report all exceptions EXCEPT for the ones in your configured exception_blacklist, add the following to the register() function in your App\Exceptions\Handler class:


To report only the exceptions that appear in your configured exception_whitelist:


The choice is yours whether you want to report all exceptions except for the ones blacklisted in the telemetry.php config file, or only report the exceptions whitelisted in the config file.

Features

There are a few extended features included in this package:

Default Context

By default, whenever you log an event, the package will always include the app environment, and the authorized user ID in the context field. If there is no active user session (for example during a scheduled job or some third party webhook request) the user ID will be set to "system".

Debug Context

Whenever you make a debug log, the package will automatically add a "class::function" context field, the value of which will tell you the class and function the log was sent from. This can be helpful when you are attempting to debug an issue in a live environment and you don't know where the bug is occuring.

Enable Switch


All versions of laravel-telemetry with dependencies

PHP Build Version
Package Version
Requires logtail/monolog-logtail Version ^3.2
illuminate/support Version ^9.0|^10.0|^11.0
php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oilytortoise/laravel-telemetry contains the following files

Loading the files please wait ....