hedii/artisan-log-cleaner
A Laravel package that adds an Artisan command to clean up old log files. Set a retention period and schedule it to automatically delete stale logs, keeping storage tidy and preventing log directories from growing indefinitely.
Architecture fit. hedii/artisan-log-cleaner is a single-purpose Laravel package: a service provider that registers one artisan command to remove log files from the app's log directory. It sits entirely in the operations tooling layer — no request-path code, no middleware, no schema changes, no impact on application architecture. That makes it architecturally "free" to adopt and equally free to remove. It is not a logging solution; it is a housekeeping utility that assumes file-based logging (single/daily drivers writing to storage/logs).
Integration feasibility. Low effort. Composer install, Laravel package auto-discovery, optionally publish the config to pin the target directory and file extension, then invoke the command manually or from the scheduler. There is no migration, no environment variable, and no runtime dependency. A competent Laravel developer can validate it in under a day.
Technical risk.
Key questions.
Stack fit. Appropriate for any conventional Laravel application using local file logging — the common case for internal tools, admin panels, and mid-size SaaS apps. It is a poor fit where logs are written to stderr/stdout (container-native patterns), shipped by a sidecar, or managed by the platform (CloudWatch, Loki, Papertrail). In those environments the package is redundant and potentially harmful if it deletes buffers before shipping.
Migration path. Additive and reversible:
composer require hedii/artisan-log-cleaner in a branch.composer remove — no residue beyond the config file.Compatibility. Pin the package version in composer.json and let the lock file govern. Validate against the specific Laravel major in use, and re-validate as part of the standard framework-upgrade checklist. Where the framework version outruns the package, the fallback is a small custom command using File::delete() over storage/logs with a retention filter — a same-day task.
Sequencing.
Maintenance. Minimal ongoing effort: version bumps and an annual health check. The real maintenance obligation is governance — an assigned internal owner, a pinned version, and a documented fallback if the package goes dormant. Budget a few hours per year, plus a half-day whenever Laravel has a major release.
Support. Community-supported MIT package with no vendor SLA. Escalation path is the maintainer's issue tracker, then a fork. Treat it as "known-good utility code we could own" rather than a supported dependency; the small surface area makes internal ownership viable.
Scaling. The command is host-local and cheap — no meaningful CPU, memory, or I/O concern at typical log volumes. The scaling question is topological, not computational: on N hosts or ephemeral containers it must run on each node (or be replaced by centralized retention), and on ephemeral filesystems it may be unnecessary entirely. Define the retention policy once, centrally, and ensure the package is one implementation of it rather than the policy itself.
Failure modes.
Ramp-up. Effectively zero for any Laravel developer: one composer command, one config review, one scheduler entry. The genuine ramp-up cost is procedural — writing the retention policy, the runbook entry, and the verification step — and that work is reusable regardless of which tool implements it.
How can I help you explore Laravel packages today?