Download the PHP package motomedialab/simple-laravel-audit without Composer

On this page you can find all versions of the php package motomedialab/simple-laravel-audit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package simple-laravel-audit

Simple Laravel Auditing

GitHub Actions

A lightweight package to provide the ability and flexibility to quickly and easily audit events and actions that happen within your Laravel application.

Installation

You can install the package via composer:

Once you've done this, run your migrations. This will create a table called audit_logs.

Configuration

Out of the box there isn't any requirement to configure the package. It will work with the default settings.

However, if you'd like to customise any options, such as the table name or classes that are utilised, you can publish the config file and change any of the options. It's designed to be flexible allowing you to change IP address resolution, user ID resolution, table name and more.

Obfuscating the IP address for compliance

You can easily obfuscate IP addresses that are submitted to the database by setting the SIMPLE_AUDITOR_OBFUSCATE_IP variable in your .env file to true. This will strip the first two octets of an IP address, ensuring it meets various compliance laws, such as GDPR. Behind the scenes this switches the default IP address fetcher with an Obfuscated IP fetcher.

Setting the retention duration

You can define how many days your logs should be kept for by setting the SIMPLE_AUDITOR_RETENTION in your .env file. If you want to keep all logs indefinitely, set this to 0.

Every time the audit logs are pruned, this will be recorded as an audit log itself.

Usage

There are multiple ways you can use this package. The most common way is to use the audit helper function.

Using the global audit helper

The audit helper function is an easy way to quickly log to the audits table. This function takes a string as the first argument, and an optional array (context) as the second argument. This will only work if you don't already have a global function called audit.

Using the facade

Some people love using Laravel's Facades due to their ease of use and static nature.

Binding to events

If you want to audit an event that happens within your application, you can do so by using the IsAuditableEvent interface. Coupled with AuditableEvent, this will automatically log the event to the audit log.

Here's an example of an event that utilises the IsAuditableEvent interface:

Using the AuditableModel trait on Models

If you have a model that you'd like to be audited on change, you can use the AuditableModel trait. By default, this will record all creations, updates and deletions for this model to the audit log. This uses Laravel model observers to listen for changes. By default, the created_at and updated_at columns are excluded from auditing.

Customising the AuditableModel functionality

If you'd like to expand the functionality of the AuditableModel trait, you can override its observer by configuring the observer key in the config file. This will allow you to create your own model observer.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.


All versions of simple-laravel-audit with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package motomedialab/simple-laravel-audit contains the following files

Loading the files please wait ....