Download the PHP package foxen/laravel-model-activity-log without Composer

On this page you can find all versions of the php package foxen/laravel-model-activity-log. 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 laravel-model-activity-log

Laravel Model Activity Log

A simple Laravel package to automatically record basic activity (creation, updates with attribute changes, deletion, restoration) performed on specified Eloquent models, and provide a mechanism for automatically pruning old log entries.

Requirements

Installation

You can install the package via composer:

The package will automatically register its service provider.

To publish the configuration file, run the following command:

This will create a foxen_activitylog.php file in your config directory, which can be modified as required.

Finally, you need to run the migrations to create the activity_log table:

Usage

To enable activity logging for a model, simply use the LogsActivity trait in your model class:

The following events are automatically logged: created, updated, deleted. If your model uses SoftDeletes, the restored event is logged as well.

When an action is performed by an authenticated user, they are recorded as the causer. Actions performed without an authenticated user (e.g. from a console command or queue job) are attributed to System.

Customizing the Log Name

By default, the log name is set to default. You can customize this on a per-model basis by adding a protected $activityLogName property to your model:

Ignoring Attributes

To exclude certain attributes from the activity log when a model is created or updated, you can add a protected $ignoreActivityLogAttributes property to your model:

Redacting Attributes

To redact sensitive attributes from the activity log, you can add a protected $redactedActivityLogAttributes property to your model. The attribute key will be logged, but the value will be replaced with [REDACTED].

You can also configure global redacted attributes in the config/foxen_activitylog.php file.

Retrieving Logs

You can retrieve activity logs using the Foxen\LaravelModelActivityLog\Models\Activity model. The package provides several convenient query scopes:

You can access the subject and causer models directly via their relationships:

For updated events, the properties field contains the old and new values of changed attributes:

Pruning Logs

The package can automatically prune old activity log entries. To enable this, set the prune_activity_log option to true in your config/foxen_activitylog.php file and configure the prune_older_than_days option.

Once enabled, you must schedule the model:prune command in your application's routes/console.php file:

Testing


All versions of laravel-model-activity-log with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.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 foxen/laravel-model-activity-log contains the following files

Loading the files please wait ...