Download the PHP package sinemacula/laravel-log-database without Composer

On this page you can find all versions of the php package sinemacula/laravel-log-database. 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-log-database

Laravel Log Database

Latest Stable Version Build Status Quality Gates Maintainability Code Coverage Total Downloads

A custom Monolog log driver for Laravel that persists log records to a database table through an Eloquent model. Registering the package's database log channel routes your application's logs into a logs table instead of, or alongside, the filesystem, so they can be queried, filtered, and retained like any other model data.

The driver is deliberately thin. It adds per-channel minimum-level filtering, serialises any exception in the log context to a string before storage, prunes old records on a retention schedule, and falls back to a configured channel stack if the database write ever fails, so a logging backend outage never costs you the log line.

How It Works

Laravel's logging stack is built on Monolog. This package registers a custom database driver with the log manager; when you log to that channel, records flow through DatabaseHandler, which writes them to the logs table via the LogMessage Eloquent model.

A few rules hold for every record before it is stored:

Installation

The service provider is registered automatically through package discovery. Publish and run the migration to create the logs table:

Configuration

Register a database channel in config/logging.php:

Define a fallback channel that is used when a database write fails:

Then point your application at the channel by setting LOG_CHANNEL=database, or include database in a stack channel to write to several destinations at once.

Usage

Once the database channel is configured, log to it like any other Laravel channel:

Or set LOG_CHANNEL=database to make it the default destination for the Log facade and the logger() helper:

The exception entry is stored as its full string representation; all other context is stored as JSON.

Pruning Old Records

LogMessage is mass-prunable. Schedule Laravel's model:prune command to delete records past the retention window configured by the channel's days option:

Records older than logging.channels.database.days days are removed on each run.

Table Schema

Column Type Notes
id uuid (primary) Generated via HasUuids
level string Monolog level name (e.g. INFO, ERROR), indexed
channel string, nullable The emitting Monolog channel
message longText The log message
context json, nullable Log context as JSON; throwables serialised to a string
extra json, nullable Monolog processor output (e.g. correlation ids)
created_at datetime(6) Record timestamp, microsecond precision, indexed

Considerations

Requirements

Testing

Changelog

See CHANGELOG.md for a list of notable changes.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md for guidelines on branching, commits, code quality, and pull requests.

Security

If you discover a security vulnerability, please report it responsibly. See SECURITY.md for the disclosure policy and contact details.

License

Licensed under the Apache License, Version 2.0.


All versions of laravel-log-database with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/database Version ^12.0 || ^13.0
illuminate/log Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
monolog/monolog Version ^3.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 sinemacula/laravel-log-database contains the following files

Loading the files please wait ...