Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cwh Laravel Package

phpnexus/cwh

A Monolog handler for Amazon CloudWatch Logs. phpnexus/cwh lets PHP applications send PSR-3 log records to CloudWatch through the AWS SDK, with configurable log groups and streams, batching, and flexible level handling for production logging.

View on GitHub
Deep Wiki
Context7

AWS CloudWatch Handler for Monolog library

Frequently asked questions about Cwh
How do I install phpnexus/cwh in a Laravel application?
Install it with Composer using composer require phpnexus/cwh. Then register a Laravel logging channel that uses the package's Monolog handler, either through the monolog driver with handler and handler_with keys or through a small custom logger factory. Keep credentials and log group and stream names in config/logging.php or environment variables rather than in application code.
Which Laravel and Monolog versions does phpnexus/cwh support?
The package is a Monolog handler, so the important compatibility check is the Monolog major version your Laravel release resolves. Monolog 1, 2 and 3 changed handler interfaces materially, so confirm the package's declared constraint before adopting it. Test against your exact Laravel and Monolog combination rather than assuming a greenfield install is representative.
How do I configure a CloudWatch Logs channel in Laravel?
Add a channel to config/logging.php using the monolog driver and pass the CloudWatch handler class plus its constructor options through handler and handler_with. Set the channel's level and bubble settings to match your existing stack. A stack channel that keeps a local file or stdout handler alongside CloudWatch is the pragmatic setup for fast local triage plus centralized retention.
How are AWS credentials resolved for CloudWatch logging?
The handler sends records through aws/aws-sdk-php, so credentials normally come from the SDK's default provider chain. In production that usually means an IAM role, an EC2 instance profile, or an ECS or EKS task role rather than long-lived access keys. Confirm the resolution order against your deployment environment before relying on it.
Does phpnexus/cwh flush logs on every request?
It buffers log records in PHP memory and flushes them over the AWS SDK's HTTP client during the request or worker lifecycle. That is fine at low to moderate volume, but it makes logging part of your application's critical path. Check the documented batch size, time-based flush, and flush-on-destruct behavior for your pinned release.
Will I lose logs if the PHP process crashes or times out?
Yes, potentially. In-memory buffering means records that have not been flushed can vanish on fatal errors, OOM kills, or hard timeouts, which are exactly the moments you most need logs. Pair the CloudWatch handler with a fast local or stdout handler in a stack channel so critical failures still leave a trace.
Does phpnexus/cwh create CloudWatch log groups and streams automatically?
Auto-creation behavior depends on the handler's configuration and the pinned release, so verify it in the package documentation or source. Many teams prefer to pre-provision log groups and streams with infrastructure as code and disable auto-creation. That keeps IAM permissions narrower and avoids surprise resources in production accounts.
Why does aws/aws-sdk-php make phpnexus/cwh a large dependency?
The handler depends on aws/aws-sdk-php, which is a large multi-service package. If your application already uses the SDK for S3, SQS, or SNS, the marginal cost is near zero. If CloudWatch logging is your only AWS integration, you are adding tens of megabytes of vendor code and a sizable transitive dependency surface for one handler.
Should I use phpnexus/cwh instead of the CloudWatch agent or Fluent Bit?
The package ships logs in-process from PHP, so it needs no daemon or sidecar and works well in containerized or serverless-adjacent deployments. A host-level agent has a different failure domain and can keep shipping logs even when the application process dies. Many teams run both: an agent where available and the handler as a fallback or for specific channels.
Is phpnexus/cwh actively maintained and safe for production?
It is MIT licensed, which means you can fork it if needed, but the project has a narrow maintainer base and a small community. Treat that as a support risk rather than a technical blocker, and pin a known-good release. Verify the release handles current CloudWatch PutLogEvents behavior, including the removal of the sequence token requirement.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo