- How do I install and configure cesargb/laravel-logs-rotate in a Laravel app?
- Install it with Composer using composer require cesargb/laravel-logs-rotate, then publish the package config with php artisan vendor:publish to get the logrotate configuration file. Set your rotation and retention policy per channel in that config and register the package's artisan command in the scheduler. The entire integration surface is the Composer package, one published config file, and one scheduled command, with no service container wiring or migrations.
- Which Laravel and PHP versions does laravel-logs-rotate support?
- The package follows standard Laravel conventions, providing a service provider, facade, artisan command, and scheduler integration, and it targets modern Laravel applications such as the 9, 10, and 11 generations. Always confirm the exact Laravel and PHP constraints in the package's composer.json before planning the work, since version constraints are the most common blocker for small utility packages. Check them against your application's pinned versions rather than assuming compatibility.
- How does log rotation and compression work in this package?
- The package rotates Laravel log files according to your configured policy, compresses the rotated files, and archives them so the active log stays manageable. It then removes archives that exceed your retention limits by age or by count. All of this runs through an artisan command that you typically drive from Laravel's scheduler, so rotation happens off the request path.
- How do I limit how many old log archives are kept?
- Retention is configured in the published config file, where you can remove old rotated logs either by age or by count. Age-based retention deletes archives after a configured number of days, while count-based retention keeps only the newest files. Because the policy is configuration-driven, you can tune it per channel so noisy logs and low-traffic channel files follow different rules.
- How do I schedule log rotation in Laravel with this package?
- Register the package's artisan command in your application's scheduler, normally in routes/console.php or your console kernel depending on your Laravel version. The package is built around the console kernel rather than middleware or service container coupling, so a single scheduled entry is enough to drive rotation. Run the command manually once in a non-production environment first to confirm the policy behaves as expected.
- Is upgrading to laravel-logs-rotate 2.9.0 safe?
- Version 2.9.0 adds a minimum file size option so very small log files are skipped during rotation. It is a small, additive, backward-compatible change shipped on a minor version bump, with no breaking changes, no deprecations, and no new runtime dependencies. In practice that makes it a low-risk composer update rather than a full re-evaluation, though you should still verify default behavior before rolling it out.
- Will the new minimum file size option appear in my existing published config file?
- Not automatically. Laravel's mergeConfigFrom merges top-level keys shallowly, so a key added in a newer release will not show up in an already-published config/logrotate.php. Confirm the package reads the threshold defensively with a safe default such as config('logrotate.min_size', 0); if it assumes the key is present, add it manually or republish the config. Also verify the default keeps rotating all files so the upgrade does not silently change behavior for teams that never touch configuration.
- Does the minimum file size threshold apply to date-based rotation as well as size-based rotation?
- The feature is described as preventing small files from being rotated, but it is unconfirmed whether the gate applies only to the size-based path or also to date-based rotation. Check the README and the package's test suite for the exact semantics before relying on it in production. Also confirm the unit and comparison behavior, meaning bytes versus a human-readable string, and whether the check is less-than or less-than-or-equal.
- Can I use laravel-logs-rotate instead of host-level logrotate in Docker or on a PaaS?
- Yes, and this is one of the package's strongest fits. Many containerized and platform-as-a-service deployments either do not expose logrotate or leave the daemon unmanaged, so handling rotation inside the app removes an external dependency. Keep in mind that if your container filesystem is ephemeral, archives disappear with the container, so write logs and archives to a persistent volume when retention matters.
- Is cesargb/laravel-logs-rotate actively maintained, and what are the long-term risks?
- It is a narrow, single-responsibility package, and single-maintainer concentration is the dominant long-term concern for projects of this size. Before adopting, review the release cadence, check for open security advisories against your pinned version, and confirm the repository responds to issues. Because there are no runtime dependencies and the integration surface is tiny, swapping it later for host-level logrotate or an alternative is low-effort, which limits the blast radius.