Download the PHP package ermetix/laravel-logger without Composer

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

Laravel Logger Package

PHP Version Laravel Version Tests Coverage

Advanced logging package for Laravel with OpenSearch, Kafka, and typed logging support.

Requirements

Quick Start

Get up and running in 3 steps:

That's it! The package is now configured and ready to use. See Installation for detailed setup instructions.

For OpenSearch setup, see the OpenSearch Setup section below.

Features

Installation

Step 1: Install the Package

For Local Development (Path Repository):

Add to your composer.json:

Then run:

For Production (Packagist):

Step 2: Automatic Installation (Recommended)

Run the installation command to automatically configure everything:

This command will automatically:

Force overwrite existing configuration:

Step 3: Verify Installation

Check that all components are correctly installed:

This command verifies:

📖 Need more details? See Installation Guide for comprehensive installation instructions, including manual configuration steps.

Configuration

Environment Variables

Add the following variables to your .env file:

Note: For local Docker development, set OPENSEARCH_VERIFY_TLS=false since Docker doesn't use HTTPS.

See env.example for all available configuration options.

📖 Want to learn more? See Configuration Guide for detailed configuration options and advanced settings.

Manual Configuration (Alternative)

If you prefer to configure manually:

Then manually add the configuration as shown in the stubs:

📖 Need help? See Installation Guide for step-by-step manual installation instructions.

OpenSearch Setup

Prerequisites

You need Docker and Docker Compose installed on your system.

📖 Detailed guide: See OpenSearch Setup Guide for comprehensive OpenSearch configuration and troubleshooting.

Step 1: Start OpenSearch

The package includes a Docker Compose configuration. You can use it in two ways:

Option A: Copy to project root (Recommended)

Option B: Use directly from package directory

Step 2: Verify OpenSearch is Running

You should see a JSON response with cluster information.

Step 3: Apply Index Templates and Policies

⚠️ IMPORTANT: Before logging, you must apply the index templates. Without this step, logs will not be indexed correctly!

Setup with OpenSearch Dashboards (Recommended):

This command will:

Setup without Dashboards:

Nota: Lo script PHP è cross-platform e funziona su Windows, Linux e macOS.

Step 4: Access OpenSearch Dashboards

After running the setup script:

  1. Open OpenSearch Dashboards: http://localhost:5601
  2. Go to Discover in the left menu
  3. Select an index pattern (e.g., api_log*)
  4. Configure visible columns manually (see below)

Note: OpenSearch Dashboards doesn't allow setting default visible columns via API. You need to configure them manually:

  1. In Discover, click the "+" button next to fields in the "Available fields" sidebar
  2. Add these recommended fields:
    • **api_log***: @timestamp, method, path, route_name, status, duration_ms, user_id, ip, request_id
    • **general_log***: @timestamp, message, event, entity_type, entity_id, action_type, user_id, level, request_id
    • **job_log***: @timestamp, job, command, status, duration_ms, exit_code, frequency, output, level, request_id
    • **integration_log***: @timestamp, integration_name, url, method, status, duration_ms, level, request_id
    • **orm_log***: @timestamp, model, action, query_type, table, duration_ms, is_slow_query, user_id, request_id
    • **error_log***: @timestamp, exception_class, code, level, context_route, context_method, context_url, context_user_id, request_id
  3. (Optional) Save the view: Click "Save" in the top right to reuse this configuration

📖 Detailed instructions: See Configure Discover Columns for step-by-step guide on setting up visible columns in OpenSearch Dashboards.

Step 5: Verify Templates

Check that templates were applied correctly:

OpenSearch Commands Reference

Start OpenSearch:

Stop OpenSearch:

Stop and remove volumes (delete all data):

View logs:

Restart OpenSearch:

Regenerate OpenSearch completely (fresh start):

Check OpenSearch health:

Search logs:

Delete old indices:

Manual Template Application (Alternative)

If you prefer to apply templates manually:

📖 Note: For most users, the automated setup script is recommended. See OpenSearch Setup Guide for more details.

Usage

Basic Usage

Available Log Types

📖 More examples: See Usage Examples for comprehensive code examples and usage patterns for all log types.

Example: API Logging

API requests are automatically logged by the ApiAccessLog middleware. No manual logging needed.

📖 Learn more: See Usage Examples - API Logging for details on how API logging works and how to customize it.

Example: Integration Logging

Example: ORM Logging

Enable ORM logging in .env:

ORM operations are automatically logged when enabled.

📖 Learn more: See Usage Examples - ORM Logging for details on ORM logging configuration and what gets logged.

Example: Job Logging

Job execution events are automatically logged when enabled (default: enabled). The LogJobEvents listener tracks:

Enable/disable in .env:

You can also manually log job events using Log::job():

Example: Error Logging

Errors and exceptions are automatically logged by the exception handler. No manual logging needed.

📖 Learn more: See Usage Examples - Error Logging for details on automatic error logging and how to log custom errors.

Testing

Run the test suite:

Or with Pest directly:

Code Coverage

To check code coverage, you need to install a coverage driver first:

Option 1: Install PCOV (Recommended - faster)

Option 2: Install Xdebug

Verify installation:

Run coverage:

The coverage report will show:

📖 Current coverage: The package maintains 99.95% code coverage (1884/1885 lines). See the generated HTML report in coverage/index.html for detailed coverage information.

Troubleshooting

Logs not appearing in OpenSearch

  1. Verify OpenSearch is running:

  2. Check templates are applied:

  3. Verify configuration:

  4. Check Laravel logs:

  5. Test logging manually:

📖 More help: See OpenSearch Setup Guide for detailed troubleshooting steps.

OpenSearch connection errors

📖 Configuration help: See Configuration Guide for all available environment variables.

Fields not visible in OpenSearch Dashboards

📖 Detailed guide: See Configure Discover Columns for step-by-step instructions on setting up visible columns.

Documentation

Getting Started

Usage & Examples

OpenSearch

Migration & Advanced

Architecture & Design

Additional Resources

License

MIT


All versions of laravel-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0
guzzlehttp/guzzle Version ^7.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 ermetix/laravel-logger contains the following files

Loading the files please wait ...