Download the PHP package robbiekibler/laravel-posthog-logs without Composer

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

Laravel PostHog Logs

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Send your Laravel application logs to PostHog using the OpenTelemetry OTLP format. Just add the package, configure your environment variables, and your logs are automatically available in PostHog.

Installation

Install the package via Composer:

Configuration

Quick Start

Add these environment variables to your .env file:

Security Note: Use a project API key (starts with phc_), not a personal API key. Project API keys have limited scope and are safe for server-side usage.

Then add the posthog channel to your config/logging.php:

To use PostHog as your default log channel, or as part of a stack:

Environment Variables

Variable Description Default
POSTHOG_API_KEY Your PostHog project API key (required)
POSTHOG_HOST PostHog host (us.i.posthog.com, eu.i.posthog.com, or self-hosted) us.i.posthog.com
POSTHOG_SERVICE_NAME Service name for log identification APP_NAME
POSTHOG_ENVIRONMENT Deployment environment APP_ENV
POSTHOG_LOG_LEVEL Minimum log level to send debug
POSTHOG_LOGS_ENABLED Enable/disable sending logs true
POSTHOG_BATCH_ENABLED Enable batching of logs true
POSTHOG_BATCH_MAX_SIZE Maximum logs per batch 100

Publishing Config (Optional)

To customize all options, publish the config file:

Testing Your Configuration

Verify your setup is working by running the test command:

This will display your current configuration and send a test log entry to PostHog. You can customize the test message:

Usage

Once configured, use Laravel's standard logging:

Trace Correlation

If you're using distributed tracing, you can include trace context:

Log Levels

The package maps Laravel/Monolog log levels to OpenTelemetry severity:

Laravel Level OTLP Severity
debug DEBUG (5)
info INFO (9)
notice INFO (10)
warning WARN (13)
error ERROR (17)
critical ERROR (18)
alert FATAL (21)
emergency FATAL (22)

Viewing Logs in PostHog

  1. Go to your PostHog dashboard
  2. Navigate to Logs in the sidebar
  3. Filter by service name, environment, or log level
  4. Click on individual logs to see full context and attributes

Advanced Configuration

Channel-Level Overrides

Override settings per channel in config/logging.php:

Custom Resource Attributes

Add custom attributes to all logs via config:

Disable in Tests

Performance Considerations

Logs are sent to PostHog via synchronous HTTP requests. The package includes:

For high-throughput applications, consider:

Testing

Changelog

Please see CHANGELOG for recent changes.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-posthog-logs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
illuminate/support Version ^10.0||^11.0||^12.0||^13.0
illuminate/log Version ^10.0||^11.0||^12.0||^13.0
guzzlehttp/guzzle Version ^7.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 robbiekibler/laravel-posthog-logs contains the following files

Loading the files please wait ...