Download the PHP package larasell-dev/chronicle without Composer

On this page you can find all versions of the php package larasell-dev/chronicle. 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 chronicle

Chronicle

Chronicle adds two things to your Laravel app: structured exceptions and wide event logging.

Structured exceptions give an exception a stable code, the reason it happened, and a fix, so you can count and alert on an error by its code, and whoever reads it knows what to do next. Wide event logging writes one event per unit of work, like a request or a job, that holds everything your app knows about it. When something goes wrong, you read one event instead of piecing the story together from scattered log lines.

Events go to a log file, to PostHog, or both. Read the full documentation for every option.

Installation

Chronicle requires PHP 8.4 and Laravel 12 or 13. You can install the package via Composer:

You can publish the config file with:

This is the contents of the published config file, without its comments:

To send events to PostHog as well as the log file, set two environment variables:

Usage

Log every request

Prepend the LogRequests middleware in bootstrap/app.php, so it runs before any other middleware and every request, a 404 included, gets one event and an X-Request-Id:

Add it once, in your app. Packages shouldn't add it.

Add fields to the current event

add() puts a field on the event of the current request or job, and only on it:

Fields you put in Laravel's Context are added to every event too, and to every log line and queued job of the request.

Record your own events

Throw structured exceptions

Throw one of the structured SPL exceptions inline:

Or give an error a class of its own:

Log queued jobs

Set CHRONICLE_LOG_JOBS=true to record one job event for every attempt of a queued job, with the fields add() collects while it runs.

Tell services, releases and hosts apart

Every event carries a few global fields, named as OpenTelemetry's resource attributes, so you can filter events from several apps, deploys or machines:

Field Set by Default
service.name CHRONICLE_SERVICE app.name (APP_NAME)
service.version CHRONICLE_RELEASE none
deployment.environment CHRONICLE_ENVIRONMENT app.env (APP_ENV)
host.name CHRONICLE_HOST gethostname(); an empty CHRONICLE_HOST= leaves it out
process.runtime.version PHP_VERSION

Set the release in your deploy, e.g. to the commit or tag, and add any other fields of your own in OpenTelemetry's key=value,key=value format, or as an array in fields of config/chronicle.php:

Chronicle reads them once at boot. A malformed setting, e.g. CHRONICLE_FIELDS="region" or more than 128 fields, its own included, throws in debug mode and in the local and testing environments. Elsewhere Chronicle ignores that setting and warns in PHP's error log, since logging must never take the app down. They are redacted and bounded like any other field. Fields Chronicle measures, such as status or route, win over them, and so do Context, add() and the fields you pass to record(). The posthog channel sends them once per batch, as the OTLP resource.

What to log

Chronicle logs what it can measure itself: the request's id, route, status, duration and user, the error, and the global fields. What makes an event useful is what only your app knows, so add it with Chronicle::add() where your code knows it:

Use the same key for the same thing everywhere, and put units last, like duration_ms. Leave out personal data such as names and email addresses, secrets, and request or response bodies.

Redact secrets

Chronicle logs the value of every key that contains a word from redact as [redacted], wherever it is in an event: in fields, Context, the query, and route parameters. A token in a path, as in /reset-password/{token}, is logged as the route's template.

Test what your code records

Chronicle::fake() keeps the finished events instead of writing them:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently. Breaking changes come with an upgrade guide.

Security Vulnerabilities

Please report security vulnerabilities through GitHub Security Advisories or by email to [email protected], not in a public issue.

Credits

About us

Chronicle is built by Larasell, an e-commerce framework for Laravel developers. Larasell lets you own the full application and customise everything from business logic to the storefront. Chronicle is the logging package Larasell and its packages use, and it works in any Laravel app.

License

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


All versions of chronicle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/http Version ^12.0|^13.0
illuminate/log Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.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 larasell-dev/chronicle contains the following files

Loading the files please wait ...