jooservices / laravel-logging
MongoDB-backed structured application logging for Laravel.
Requires
- php: ^8.5
- jooservices/dto: ^3.0
- jooservices/laravel-repository: ^4.0
- laravel/framework: ^12.0|^13.0
- mongodb/laravel-mongodb: ^5.7
Requires (Dev)
- captainhook/captainhook: ^5.23
- captainhook/plugin-composer: ^5.3
- fakerphp/faker: ^1.23
- friendsofphp/php-cs-fixer: ^3.65
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.0|^11.0
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.5
- squizlabs/php_codesniffer: ^3.8
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-28 11:39:48 UTC
README
jooservices/laravel-logging stores structured activity, audit, security,
domain, and system logs in MongoDB for Laravel applications.
v4.0.0 requires
jooservices/dto^3 andjooservices/laravel-repository^4. See UPGRADE.md and the changelog.
Features
- Structured records through activity, audit, security, domain, and system adapters.
- MongoDB persistence, indexes, and query helpers.
- Optional queue dispatch, model audit logging, retention, and JSONL/CSV export.
Requirements
- PHP ^8.5
- Laravel 12 or 13
mongodb/laravel-mongodb^5.7 and a configured MongoDB connectionjooservices/dto^3 andjooservices/laravel-repository^4
Installation
composer require jooservices/laravel-logging php artisan vendor:publish --tag=laravel-logging-config php artisan activity-log:indexes
Set the MongoDB connection and package collection in your environment as needed:
ACTIVITY_LOG_CONNECTION=mongodb ACTIVITY_LOG_COLLECTION=activity_logs MONGODB_URI=mongodb://localhost:27017
Check that the package can resolve its runtime configuration before using the adapter:
php artisan activity-log:doctor
Quick start
use JOOservices\LaravelLogging\Facades\ActivityLog; ActivityLog::system() ->commandStarted('scheduler:run') ->save();
save() persists synchronously and returns an ActivityLogRecord. See
Queueing for dispatching work to a queue.
Design notes
- This package stores structured application records; it is not a replacement for Laravel Log, Monolog, Sentry, OpenTelemetry, Loki, ELK, or a full observability stack.
- Model audit logging is opt-in through the
LogsActivitytrait. - For admin timelines or compliance event streams, see the ecosystem decision tree.
Documentation
- Documentation index
- Installation
- Basic usage
- Custom adapters
- Queueing
- Querying
- Retention and export
- Model auditing and domain mappers
- Adapter cookbook
- Upgrade guide
- Changelog
- Workflow reference
Development
The Makefile runs the package's Docker Compose toolchain:
make build
make install
make lint-all
make test
make ci
Integration tests use MongoDB. See testing and linting and the contributing guide for setup and quality checks.
Community
License
MIT — see LICENSE.