Download the PHP package greelogix/request-logger without Composer

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

Request Logger

A Laravel package for logging HTTP requests with automatic sensitive data masking and a beautiful web UI for viewing logs.

Features

Requirements

Installation

1. Install the Package

Add the package to your Laravel project via Composer:

2. Run the Install Command

This will publish the configuration file and provide setup instructions:

Note: If you already have a config file, the install command will automatically add any missing new configuration options (like ui_middleware and allowed_emails) without overwriting your existing settings. To force overwrite the entire config file, use the --force flag:

3. Publish and Run Migrations

Publish the migration file:

Run the migrations:

4. Register the Middleware

The middleware needs to be registered to start logging requests.

For Laravel 11

Add the middleware to bootstrap/app.php:

Option 1: Using use statement (recommended):

Option 2: Using fully qualified class name:

For Laravel 10

Add the middleware to app/Http/Kernel.php in the $middlewareGroups['web'] array:

Option 1: Using use statement (recommended):

Option 2: Using fully qualified class name:

Note: The namespace is GreeLogix (with capital G, L, and X). Make sure the casing is correct to avoid class not found errors.

Usage

Accessing the Log Viewer

Once the middleware is registered and you've made some requests, visit:

The route is automatically registered by the package and requires authentication by default. You can configure which middleware to use and restrict access to specific user emails (see UI Security Configuration below).

Viewing Logs

The web UI displays:

Click "View Payload" on any log entry to see the full request/response details.

Configuration

Publishing Configuration

The configuration file is automatically published when you run php artisan gl-request-logger:install. You can also publish it manually:

The configuration file will be published to config/gl-request-logger.php.

Configuration Options

enabled

Enable or disable request logging globally.

driver

Choose the logging driver: database or file.

connection

Optional. Database connection name to use for storing logs.

By default, you don't need to configure anything - the package will automatically use your default database connection. You only need to set this if you want to use a separate database.

Example (Optional): To use a separate database connection named logs:

  1. First, configure the connection in config/database.php:

  2. Then set the connection in your .env file:

  3. When running migrations, make sure to specify the connection:

Or update the migration file to use the configured connection (the package migration already handles this automatically).

Important Notes:

table

Database table name for storing logs (when using database driver).

file_channel

Log channel to use when using file driver.

masked_keys

Array of keys to automatically mask in request/response data. Keys are matched case-insensitively and can use partial matching.

ignored_routes

Array of path/URI patterns to exclude from logging. Uses Laravel's Str::is() matching with wildcard support.

Examples:

ignored_urls

Array of full URL patterns to exclude from logging. Supports wildcards and regex patterns.

Examples:

ignored_paths_regex

Array of regular expression patterns for path/URI matching. Must be valid regex patterns.

Examples:

slow_request_threshold_ms

Threshold in milliseconds for marking requests as "slow". Requests exceeding this duration will be marked with a red "SLOW" badge.

log_html_responses

Whether to log HTML response bodies. If set to false, HTML responses will be replaced with "HTML response" text to reduce database size.

per_page

Number of log entries to display per page in the log viewer UI. Default is 50.

ui_middleware

Array of middleware to apply to the log viewer UI routes. This allows you to protect the UI with authentication, authorization, or other middleware.

Default: ['auth'] (requires authentication)

Examples:

Note: The web middleware group is always applied automatically. This configuration allows you to add additional middleware on top of that.

allowed_emails

Array of user email addresses that are allowed to access the log viewer UI. If this array is empty, all authenticated users can access the UI (subject to the ui_middleware configuration).

If this array contains emails, only users with those email addresses will be allowed to access the UI, even if they pass the middleware checks.

Default: [] (all authenticated users can access)

Examples:

Note: When allowed_emails is configured, the user must be authenticated and their email must be in the allowed list. If the user is not authenticated or their email is not in the list, they will receive a 403 Forbidden error.

Environment Variables

You can configure the package using environment variables:

Note:

Note: Set GL_REQUEST_LOGGER_CONNECTION to a connection name (e.g., logs) to use a separate database, or leave it unset/empty to use the default connection.

Logging Drivers

Database Driver

Stores logs in the gl_request_logs database table. This is the default driver and provides the best performance for viewing logs through the web UI.

By default, logs are stored in your application's default database connection. No additional configuration is required.

Optional: You can configure the package to use a separate database connection by setting the connection option. This is useful for:

Note: Using a separate database is completely optional. The package works perfectly fine with your default database connection.

See the Connection Configuration section above for setup instructions (only if you want to use a separate database).

File Driver

Stores logs in Laravel's log files. Useful for high-traffic applications or when you don't want to store logs in the database.

What Gets Logged

For each request, the following information is captured:

Security

Sensitive Data Masking

The package automatically masks sensitive data in:

Sensitive keys are matched case-insensitively and can use partial matching. For example, password will match password, Password, user_password, etc.

Masked values are replaced with *** in the logs.

Route Exclusions

You can exclude specific routes, URLs, or endpoints from being logged using multiple configuration options:

By default, the request logger UI routes are excluded to prevent logging the log viewer itself.

UI Security

The log viewer UI is protected by default with authentication middleware. You can further restrict access using two configuration options:

Middleware Protection

Configure which middleware should be applied to the UI routes using the ui_middleware configuration option. By default, the auth middleware is applied, requiring users to be authenticated.

Example: Require authentication and email verification:

Example: Use Sanctum authentication:

Example: No additional middleware (only web middleware):

Email-Based Access Control

Restrict access to specific user emails using the allowed_emails configuration option. When configured, only users with email addresses in the allowed list can access the UI, even if they pass the middleware checks.

Example: Allow only specific admin emails:

Example: Allow all authenticated users (default):

Important:

Publishing Assets

Views

To customize the log viewer UI, publish the views:

Views will be published to resources/views/vendor/gl-request-logger/.

Troubleshooting

Package Installation Conflicts

If you encounter dependency conflicts during installation:

Error: Your requirements could not be resolved to an installable set of packages

Solution: Ensure you're using Laravel 10 or 11. If you're on an older version, upgrade Laravel first:

Then try installing the package again:

Migration Already Exists / Table Already Exists

If you get an error about the table already existing (e.g., Base table or view already exists: 1050 Table 'gl_request_logs' already exists):

This usually happens when:

Solutions:

  1. If using a custom connection, make sure the table exists on that connection. Check your connection:

  2. If the table exists on the wrong connection, you can either:

    • Drop and recreate on the correct connection:

    • Or manually move the table to the correct database/connection
  3. If migrations are running twice, the package automatically checks if the table exists before creating it (as of the latest version). If you still see this error:

  4. Manual cleanup (if needed):

No Logs Appearing

  1. Check that the middleware is registered correctly
  2. Verify that enabled is set to true in the config
  3. Check that the route you're testing isn't in the ignored_routes list
  4. If using database driver, ensure the migration has run successfully
  5. If using file driver, check your Laravel log files

Class Not Found Errors

If you encounter class not found errors:

  1. Run composer dump-autoload
  2. Clear Laravel's cache: php artisan config:clear and php artisan cache:clear

Greelogix Package Structure

This package follows the Greelogix organizational structure and naming conventions. For detailed information about:

These documents outline the consistent patterns used across all Greelogix packages, including:

License

MIT

Support

For issues, questions, or contributions, please open an issue on the repository.


All versions of request-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.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 greelogix/request-logger contains the following files

Loading the files please wait ...