Download the PHP package andriichuk/laravel-http-logger without Composer

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

Laravel HTTP Logger

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

A super simple, configurable HTTP request and response logger for Laravel, ideal for APIs.

Installation

Requirements: PHP 8.3+ and Laravel 11.x, 12.x, or 13.x.

Install the package via Composer:

Publish the config file:

(Optional) Add a dedicated log channel for HTTP logs in config/logging.php (e.g. a separate file or stack). If you skip this, the package uses your default log channel.

Important — when is logging on? If LOG_HTTP_REQUESTS is not set in .env, the logger follows APP_DEBUG: it is enabled when APP_DEBUG=true (e.g. local) and disabled when APP_DEBUG=false (e.g. production). To force it on or off, set LOG_HTTP_REQUESTS=true or LOG_HTTP_REQUESTS=false in your .env, or set 'enabled' in config/http-logger.php. The log channel can be overridden with HTTP_LOG_CHANNEL (e.g. HTTP_LOG_CHANNEL=http to use the channel above).

Configuration

After publishing, configure config/http-logger.php as needed.

Key Description Default
enabled Master switch for HTTP logging. When LOG_HTTP_REQUESTS is unset, falls back to APP_DEBUG. env('LOG_HTTP_REQUESTS', APP_DEBUG)
channel Log channel name (must exist in config/logging.php). HTTP_LOG_CHANNEL or LOG_CHANNEL or 'daily'
routes Laravel route patterns to log (with or without leading slash). [] = none; ['*'] = all; ['/api/*'] = API only. ['*']
report Which response status categories to log: info (1xx), success (2xx), redirect (3xx), client_error (4xx), server_error (5xx). Each key is a boolean. info/successfalse; redirect/client_error/server_errortrue
log_level_by_status Map each status category to a PSR log level (debug, info, notice, warning, error, etc.). 5xx → error and 4xx → warning by default for easier filtering. client_errorwarning; server_errorerror; others → info
include_response Include response body in log context. true
include_non_json_response When include_response is true, include non-JSON bodies (HTML, text, etc.) in the log (truncated). Set to true to include them; default logs as '[skipped]'. false
include_request_headers Request header names (lowercase) to include. Use ['*'] for all. ['*']
include_response_headers Response header names (lowercase) to include. Use ['*'] for all. []
sensitive_fields Request/response body keys to replace with ***. ['token', 'refresh_token', 'password', …]
sensitive_headers Header names (lowercase) to replace with ***. ['authorization', 'cookie']
max_string_value_length Max length for string values in bodies (and non-JSON response body) before truncation. Use null to disable truncation. 100
message_prefix Prefix for the log message. '[HttpLogger] '
include_host_in_message Include request origin (protocol + host, e.g. https://example.com) in the log message. false
include_session_errors When true, add flashed validation errors (e.g. from redirect()->withErrors()) to log context as session_errors. Read-only; does not consume flash. false
include_uploaded_files_metadata When true, add metadata for uploaded files (original name, size, MIME type, extension) to log context as uploaded_files. No file contents are logged. true

Response body logging: JSON responses are decoded and sanitized; max_string_value_length applies to each string value. Non-JSON responses are logged as a truncated string or '[skipped]'. The log level follows response status by default (5xx → error, 4xx → warning, 1xx/2xx/3xx → info); configure via log_level_by_status.

Example log output

API validation error (422): WARNING level, authorization and cookie masked, JSON response with validation errors.

API file upload validation error (422): WARNING level, file input shown as [object] in request body, uploaded_files metadata (name, size, mime_type, etc.) in context.

Web auth form (redirect with flash): INFO level, sensitive headers and fields masked, non-JSON response logged as [skipped], session_errors with flashed validation message (e.g. login failure). Set include_session_errors to true in your config to get session_errors in the log.

Testing

Run the test suite with Pest:

Changelog

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

License

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

Credits


All versions of laravel-http-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^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 andriichuk/laravel-http-logger contains the following files

Loading the files please wait ...