crudlog / laravel-logger
The official CrudLog client package for implicitly logging activities in Laravel applications.
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.2
- illuminate/contracts: ^11.0
- illuminate/database: ^11.0
- illuminate/events: ^11.0
- illuminate/http: ^11.0
- illuminate/support: ^11.0
Requires (Dev)
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^10.5
README
The official CrudLog client package for Laravel applications. This package provides a seamless, "zero-code on models" experience for implicitly logging Eloquent model events to your CrudLog account.
Features
- Implicit Logging: Automatically log
created
,updated
, anddeleted
events for any Eloquent model. - Configuration Driven: All settings are managed from your CrudLog dashboard—no need to define what to log in your code.
- Asynchronous by Default: Uses your application's queue for maximum performance, ensuring your user requests are never slowed down by logging.
- Tenant-Aware: Securely associates all logs with your specific account.
Installation
You can install the package via Composer:
composer require crudlog/laravel-logger
The package will automatically register its service provider.
Next, you must publish the configuration file using the vendor:publish
command:
php artisan vendor:publish --provider="CrudLog\Logger\Providers\LoggableServiceProvider" --tag="crudlog-config"
This will create a config/logging-service.php
file in your application.
Configuration
Finally, add your CrudLog API Key and preferred dispatch method to your application's .env
file. You can generate an API key from your CrudLog API Keys dashboard.
CRUDLOG_API_KEY="your-api-key-here" CRUDLOG_DISPATCH_METHOD=async # Can be 'async' (recommended) or 'sync'
Usage
Once the package is installed and configured, no further code changes are needed in your application to start logging.
- Log in to your CrudLog dashboard.
- Navigate to the Logging Configuration page.
- Enable Implicit Logging.
- Add the fully qualified class names of the Eloquent models you wish to track (e.g.,
App\Models\User
). - Select the events (
created
,updated
,deleted
) you want to monitor for each model. - Save your configuration.
Our service will now automatically start capturing events for the models you've configured.
Security
If you discover any security related issues, please email your-security-email@crudlog.test instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.