The Laravel Auditing package should be installed via Composer. To get the latest package version, execute the following command from your project root:
composer require owen-it/laravel-auditing
This package supports Laravel and Lumen from version 5.2 onward.
If you're upgrading, make sure the
audits table schema is up to date!
Changes to the table schema are needed when upgrading from any of the previous versions!
The Laravel and Lumen configurations vary slightly, so here are the instructions for each of the frameworks.Additionally, you can utilize a video tutorial for guidance on the installation process
config/app.php file and add the following line to register the service provider:
'providers' => [ // ... OwenIt\Auditing\AuditingServiceProvider::class, // ... ],
If you're on Laravel version 5.5 or higher, you can skip this part of the setup in favour of the Auto-Discovery feature.
bootstrap/app.php file and add the following line to register the service provider:
// ... $app->register(OwenIt\Auditing\AuditingServiceProvider::class); // ...
You will also need to enable
// ... $app->withFacades(); $app->withEloquent(); // ...
vendor:publish command doesn't exist in Lumen, so an extra package must be installed:
composer require irazasyed/larasupport
After the package is installed, the service provider must be registered in
// ... $app->register(Irazasyed\Larasupport\Providers\ArtisanServiceProvider::class); // ...
The service provider registration is mandatory in order for the configuration to be published!
After configuring your framework of choice, use the following command to publish the configuration settings:
php artisan vendor:publish --provider "OwenIt\Auditing\AuditingServiceProvider" --tag="config"
This will create the
config/audit.php configuration file.
You can read more about the configuration options in the General Configuration section.
Lumen by default doesn't read from
config location. Make sure to load the configuration on boot. Edit the
// ... $app->configure('audit'); return $app; // ...
audits table migration to the
database/ directory with the following command:
php artisan vendor:publish --provider "OwenIt\Auditing\AuditingServiceProvider" --tag="migrations"
If needed, the migration file can be customised. Have a look at the Audit Migration section for some of the changes that can be performed.
Once done, execute the
artisan command to migrate, creating the
audits table in your database:
php artisan migrate
This is where the
Audit records will be stored, by default.
Find out more about resolvers in the Audit Resolvers section!