PHPackages                             allenkhoury/user-activity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. allenkhoury/user-activity

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

allenkhoury/user-activity
=========================

Dashboard that will track user activity and online users.

v1.0.1(2y ago)010JavaScript

Since Aug 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/allenkhoury/user-activity)[ Packagist](https://packagist.org/packages/allenkhoury/user-activity)[ RSS](/packages/allenkhoury-user-activity/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel user activity and tracking
==================================

[](#laravel-user-activity-and-tracking)

This package provides real-time tracking of active users on your website and logs their activity. It can be installed on any Laravel project version 9 or 10.

The real-time tracking is powered by websockets, so you will need to set up a Pusher account. Alternatively, laravel-websocket can also be used.

[![Dashboard](public/dashboard.png)](public/dashboard.png)

---

Requirement
-----------

[](#requirement)

- PHP 8.1+
- Laravel 9|10
- Pusher (For real-time tracking)

---

Installing
----------

[](#installing)

Install this package through composer:

```
composer require allenkhoury/user-activity
```

Once installed, it will be auto discovered by laravel.

Next, we need to publish the necessary data for this package: migrations, config and assets.

- migrations: tables required to log user activity.
- config: a set of options to tweak the plugin.
- assets: these are required to load the user activity dashboard panel.

Run the code below to publish all package necessary data:

```
php artisan vendor:publish --tag=al-user-activity.package
```

We can then run migrate to create the package's tables in the database.

```
php artisan migrate
```

---

Real time tracking
------------------

[](#real-time-tracking)

This package provides real-time tracking of active users on your website using websockets. Pusher is the preferred websockets provider for this package.

**Installing Pusher**

To install Pusher, you can follow the instructions in the [Laravel broadcasting documentation](https://laravel.com/docs/8.x/broadcasting#pusher-channels).

**Adding the tracking script to your layout file**

Once you have installed Pusher, you need to add the following code to your layout blade file, at the bottom of the file after scripts:

```
@tracking_script
```

This custom blade directive will inject some scripts in your layout file so Laravel Echo can start tracking properly.

**Enabling real-time tracking**

Finally, you need to enable real-time tracking by setting the following environment variable:

```
AL_TRACKING_ENABLED=true

```

**Setting the user identifier**

The package needs to know which column in your database contains the user's name. By default, the package assumes that the column is called `name`. However, you can change this by setting the user\_identifier option in the package configuration file.

---

Activity log
------------

[](#activity-log)

This package can also log user activity on the website. This can be useful for tracking how users are interacting with your website and identifying potential problems.

**Enabling activity logging**

To enable activity logging, you need to set the following environment variable to `true`:

```
AL_ACTIVITY_LOG_ENABLED=true

```

**Configuration**

By default, this package will track the following HTTP requests:

- POST
- PUT
- PATCH
- DELETE

However, you can change this configuration by editing the `allowed_methods` option in the package's published configuration file. For example, to only track POST and PUT requests, you would change the configuration to the following:

```
'activity_log' => [
    'enabled' => env('AL_ACTIVITY_LOG_ENABLED', false),
    'allowed_methods' => [
        'POST', 'PUT'
    ],
]
```

You can check the supported HTTP methods in the [Laravel route documentation](https://laravel.com/docs/10.x/routing#available-router-methods)

**Exceptions**

You can exclude some routes from being tracked by adding the `no-logging` middleware to your routes.

**Note**: This package will only log activity of **authenticated** users. Guests will not be tracked.

---

Dashboard
---------

[](#dashboard)

The package comes with a dashboard that allows you to track active users and check all activity logs.

**Enabling the dashboard**

The dashboard is enabled by default. To disable it, set the following environment variable to `false`:

```
AL_DASHBOARD_ENABLED=false

```

**Dashboard URL**

The dashboard is available on the URL `/al-user-activity`. You can change the URL by adding a prefix using the option `url_prefix` in the package configuration file. For example, to add the prefix admin (/admin/al-user-activity), you would change `url_prefix` as follows:

```
'dashboard' => [
    'enabled' => env('AL_DASHBOARD_ENABLED', true),
    'url_prefix' => 'admin',
    'extra_middlewares' => [],
],
```

**Dashboard access**

By default, any authenticated user can access the dashboard. To restrict access, for example to just admins, you can add your custom middleware alias to the option `extra_middleware`s in the package configuration file. For example:

```
'dashboard' => [
    'enabled' => env('AL_DASHBOARD_ENABLED', true),
    'url_prefix' => 'admin',
    'extra_middlewares' => ['admin-middleware-alias'],
],
```

*Note: You can add as many middlewares as needed.*

---

General notes
-------------

[](#general-notes)

The package will use the model set in `config('auth.provider.users.model')` as the users model.

The dashboard UI is built using the free template [Sneat](https://themeselection.com/item/sneat-free-bootstrap-html-admin-template/) by [ThemeSelection](https://themeselection.com/)

---

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/.../blob/master/LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

994d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c1d823437598367a36b4b797aecaf53e88b603d8b059f30cffb2fb596928eeb?d=identicon)[useralain2](/maintainers/useralain2)

---

Top Contributors

[![allenkhoury](https://avatars.githubusercontent.com/u/11290629?v=4)](https://github.com/allenkhoury "allenkhoury (2 commits)")

### Embed Badge

![Health badge](/badges/allenkhoury-user-activity/health.svg)

```
[![Health](https://phpackages.com/badges/allenkhoury-user-activity/health.svg)](https://phpackages.com/packages/allenkhoury-user-activity)
```

###  Alternatives

[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[yajra/laravel-datatables-buttons

Laravel DataTables Buttons Plugin.

2629.1M54](/packages/yajra-laravel-datatables-buttons)[yajra/laravel-datatables

Laravel DataTables Complete Package.

1035.8M52](/packages/yajra-laravel-datatables)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[sebastienheyd/boilerplate

Laravel Boilerplate based on AdminLTE 3 with blade components, user management, roles, permissions, logs viewer, ...

28618.2k3](/packages/sebastienheyd-boilerplate)[flarum/pusher

See new discussions and posts in real-time using Pusher.

22367.3k4](/packages/flarum-pusher)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
