Download the PHP package tasmir/activity-tracker without Composer

On this page you can find all versions of the php package tasmir/activity-tracker. 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 activity-tracker

Activity Tracker for Laravel

A powerful, standalone Laravel package to automatically track and log user activities, model changes, and authentication events. This package simplifies audit logging and activity tracking with minimal configuration.

Features

Installation

You can install the package via composer:

The package will automatically register itself. To create the necessary database table, run the migrations:

Configuration (Optional)

You can publish the configuration file to customize the package behavior (e.g., disabling auto-tracking):

Basic Usage

1. Generating a Tracker

The easiest way to track a model (e.g., User) is to use the generator command:

This command will:

2. Manual Logging

You can inject the UserActivityService into your controllers or jobs for manual logging:

3. Authentication Events

The package automatically listens for Laravel's built-in authentication events. No extra setup is required to log:

Management Commands

List Tracked Models

To see all models currently being tracked and the events they handle:

Bulk Track All Models

To automatically generate tracker classes for every model in your app/Models directory that isn't already tracked:

Remove Tracking

To delete a tracker from a model:

Auto-Tracking

By default, the package listens for the make:model command. When you create a new model, it will automatically trigger the generation of a corresponding tracker:

You can disable this in the config/activity-tracker.php file by setting auto_track_models to false.

2. Authentication Events

User Login and Logout events are tracked by default. You can also toggle the tracking of login and logout events in the configuration:

3. URL Visit Tracking

To track pages visited by authenticated users, you can enable URL tracking and register the middleware in your application.

Configuration

In config/activity-tracker.php:

Middleware Registration (Laravel 12+)

In bootstrap/app.php, register the middleware:

4. Detailed URL Visit Tracking

For deep analytics, you can enable detailed tracking which captures location data (City, Country), IP, User Agent, Referer, Query Params, and request duration.

Configuration

In config/activity-tracker.php:

Middleware Registration (Laravel 12+)

In bootstrap/app.php:

Database Table

This feature uses the url_visits table. Make sure to run the migrations:

Activity Log Cleanup

The package includes an automated scheduler to clean up old activity logs.

Configuration

In config/activity-tracker.php:

Manual Cleanup

You can also manually cleanup logs using the command:

Activity Log Data

The user_activities table stores the following information:

Key Type Description
user_id bigint The ID of the user performing the action.
model_id bigint The ID of the model being affected.
model_type string The class name of the model being affected.
action string The action performed (e.g., created, login).
description text A human-readable description of the activity.
previous_data json (Optional) Model state before the change.
new_data json (Optional) Model state after the change.

Relationships

If you want to access a user's activity logs, the track:model command automatically adds a relationship to the User model. You can access it like this:

Contributing

Contributions are welcome! If you have any ideas, bug fixes, or improvements, feel free to open an issue or submit a pull request on GitHub.


Developed by Tasmir

License

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


All versions of activity-tracker with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.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 tasmir/activity-tracker contains the following files

Loading the files please wait ...