Skip to content

Commit c3e6eb8

Browse files
authored
Merge pull request #52 from binafy/improve-readme
[1.x] Improve readme
2 parents a03e386 + cca9a3b commit c3e6eb8

File tree

2 files changed

+71
-54
lines changed

2 files changed

+71
-54
lines changed

README.md

Lines changed: 65 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ After publishing, run the `php artisan migrate` command.
9797
<a name="usage"></a>
9898
## Usage
9999

100-
The `Laravel-User-Monitoring`, need to use middleware, traits, etc ... and it's not hard, enjoys :)
100+
The `Laravel-User-Monitoring`, needs to use middleware, traits, etc ... and it's not hard, enjoys :)
101101

102102
<a name="configuration"></a>
103103
## Configuration
@@ -117,10 +117,13 @@ Also, if you want to change the route file name, you can go to the config file a
117117

118118
```php
119119
/*
120-
* Configurations.
120+
* Main configuration settings for the package.
121121
*/
122122
'config' => [
123123
'routes' => [
124+
/*
125+
* Path to the route file that handles user monitoring routes.
126+
*/
124127
'file_path' => 'routes/user-monitoring.php',
125128
],
126129
],
@@ -134,39 +137,36 @@ You can config your user with the `user-monitoring.php` configuration file:
134137
```php
135138
'user' => [
136139
/*
137-
* User model.
140+
* Specify the fully qualified class name of the user model.
138141
*/
139142
'model' => 'App\Models\User',
140143

141144
/*
142-
* Foreign Key column name.
145+
* Name of the foreign key column linking user data to other models.
143146
*/
144147
'foreign_key' => 'user_id',
145148

146149
/*
147-
* Users table name.
150+
* Name of the table storing user data.
148151
*/
149152
'table' => 'users',
150153

151154
/*
152-
* You can customize which guards are used to authenticate or
153-
* store user data across different parts of the application. Each guard
154-
* will be checked independently, allowing users to be authenticated by
155-
* multiple guards and enabling more flexible user management.
156-
*
157-
* Make sure that each guard is properly configured under the 'guards' section in the auth.php config file.
155+
* Defines the authentication guards used for verifying the user.
156+
* Multiple guards can be specified for flexible authentication strategies.
157+
* Ensure these guards are configured correctly in the 'guards' section of the auth.php config file.
158158
*/
159159
'guards' => ['web'],
160160

161161
/*
162-
* If you are using uuid or ulid you can change it for the type of foreign_key.
163-
*
164-
* When using ulid or uuid, you need to add related traits into the models.
162+
* Specify the type of foreign key being used (e.g., 'id', 'uuid', 'ulid').
163+
* For non-standard IDs, make sure to add the relevant traits to your models.
165164
*/
166-
'foreign_key_type' => 'id', // uuid, ulid, id
165+
'foreign_key_type' => 'id', // Options: uuid, ulid, id
167166

168167
/*
169-
* If you want to display a custom username, you can create your attribute in User and change this value.
168+
* Attribute of the user model used to display the user's name.
169+
* If you wish to use a different attribute (e.g., username), change this value accordingly.
170170
*/
171171
'display_attribute' => 'name',
172172
],
@@ -177,7 +177,7 @@ You can config your user with the `user-monitoring.php` configuration file:
177177
- `table`: You can write your users table name if is not `users.
178178
- `guards`: The guards are used to authenticate.
179179
- `foreign_key_type`: The foreign key type (uuid-ulid-id).
180-
- `display_attribute`: The special attribute of user that you want to show in views.
180+
- `display_attribute`: The special attribute of the user that you want to show in views.
181181

182182
<a name="foreign-key-type-uuid-ulid-id"></a>
183183
### Foreign Key Type (UUID, ULID, ID)
@@ -189,11 +189,10 @@ If you are using `uuid` or `ulid`, you can change `foreign_key_type` to your cor
189189
...
190190

191191
/*
192-
* If you are using uuid or ulid you can change it for the type of foreign_key.
193-
*
194-
* When you are using ulid or uuid, you need to add related traits into the models.
192+
* Specify the type of foreign key being used (e.g., 'id', 'uuid', 'ulid').
193+
* For non-standard IDs, make sure to add the relevant traits to your models.
195194
*/
196-
'foreign_key_type' => 'uuid', // uuid, ulid, id
195+
'foreign_key_type' => 'id', // Options: uuid, ulid, id
197196
],
198197
```
199198

@@ -229,11 +228,13 @@ If you want to disable monitoring for specific pages you can go to `user-monitor
229228
```php
230229
'visit_monitoring' => [
231230
/*
232-
* You can specify pages not to be monitored.
231+
* List of pages that should be excluded from visit monitoring.
232+
* Add route names or URL paths to this array if you want to exclude certain pages.
233233
*/
234234
'except_pages' => [
235-
'home',
236-
'admin/dashboard',
235+
'user-monitoring/visits-monitoring',
236+
'user-monitoring/actions-monitoring',
237+
'user-monitoring/authentications-monitoring',
237238
],
238239
],
239240
```
@@ -250,12 +251,13 @@ First, you need to go to the `user-monitoring` config file and highlight the day
250251
...
251252

252253
/*
253-
* If you want to delete visit rows after some days, you can change this to 360,
254-
* but if you don't like to delete rows you can change it to 0.
254+
* Set the number of days after which visit records should be automatically deleted.
255+
* Set to 0 to disable automatic deletion.
255256
*
256-
* For this feature you need Task-Scheduling => https://laravel.com/docs/10.x/scheduling
257+
* To enable automatic deletion, configure Laravel's task scheduling as outlined here:
258+
* https://laravel.com/docs/scheduling
257259
*/
258-
'delete_days' => 10,
260+
'delete_days' => 0,
259261
],
260262
```
261263

@@ -286,14 +288,15 @@ You can change `hourly` to `minute` or `second`, for more information you can re
286288
<a name="turn-on-off"></a>
287289
### Turn ON-OFF
288290

289-
Maybe you want to turn off visit monitoring for somedays or always, you can use configuration to turn it off:
291+
Maybe you want to turn off visit monitoring for some or always, you can use configuration to turn it off:
290292

291293
```php
292294
'visit_monitoring' => [
293295
...
294296

295297
/*
296-
* If you want to disable visit monitoring, you can change it to false.
298+
* Enable or disable the visit monitoring feature.
299+
* Set false to disable tracking of user visits.
297300
*/
298301
'turn_on' => true,
299302

@@ -304,7 +307,7 @@ Maybe you want to turn off visit monitoring for somedays or always, you can use
304307
<a name="visit-monitoring-views"></a>
305308
### Visit Monitoring Views
306309

307-
Laravel-User-Monitoring also has an amazing views that you can use it very easy, just need to go to `/user-monitoring/visits-monitoring` url, and enjoy:
310+
The `Laravel-User-Monitoring` also has amazing views that you can use very easily, just need to go to the `/user-monitoring/visits-monitoring` URL, and enjoy:
308311

309312
![Visit Monitoring Preview](/art/visits-monitoring/preview.png "Visit Monitoring")
310313

@@ -314,16 +317,17 @@ Laravel-User-Monitoring also has an amazing views that you can use it very easy,
314317
Maybe you may disable record visits for `Ajax` requests, you can use config to disable it:
315318

316319
```php
317-
'visit_monitoring' => [
318-
...
320+
'visit_monitoring' => [
321+
...
319322

320-
/*
321-
* If you want to disable visit monitoring in Ajax mode, set it to false.
322-
*/
323-
'ajax_requests' => true,
323+
/*
324+
* Enable or disable monitoring for AJAX requests.
325+
* Set to false if you do not wish to track AJAX-based page loads.
326+
*/
327+
'ajax_requests' => true,
324328

325-
...
326-
],
329+
...
330+
],
327331
```
328332

329333
When set to false, Ajax requests will not be recorded.
@@ -356,11 +360,10 @@ If you want to disable some actions like created, you can use the config file:
356360
...
357361

358362
/*
359-
* Monitor actions.
360-
*
361-
* You can set true/false for monitor actions like (store, update, and ...).
363+
* Enable or disable monitoring of specific actions (e.g., store, update, delete).
364+
* Set to true to monitor actions or false to disable.
362365
*/
363-
'on_store' => false,
366+
'on_store' => true,
364367
'on_update' => true,
365368
'on_destroy' => true,
366369
'on_read' => true,
@@ -387,7 +390,8 @@ If you want to monitor users when logging in or logout of your application, you
387390
...
388391

389392
/*
390-
* You can set true/false for monitor login or logout.
393+
* Enable or disable monitoring of user login and logout events.
394+
* Set to true to track these actions, or false to disable.
391395
*/
392396
'on_login' => true,
393397
'on_logout' => true,
@@ -400,13 +404,21 @@ If you want to monitor users when logging in or logout of your application, you
400404
If you are using Reverse Proxy (Nginx or Cloudflare), you can use config to get real IP from a specific header like `X-Real-IP` or `X-Forwarded-For`:
401405

402406
```php
403-
/**
404-
* Determines if the application should use reverse proxy headers to fetch the real client IP
405-
* If set to true, it will try to get the IP from the specified header (X-Real-IP or X-Forwarded-For)
406-
* This is useful when using reverse proxies like Nginx or Cloudflare.
407-
*/
408-
'use_reverse_proxy_ip' => true,
409-
'real_ip_header' => 'X-Forwarded-For',
407+
'action_monitoring' => [
408+
...
409+
410+
/*
411+
* If your application is behind a reverse proxy (e.g., Nginx or Cloudflare),
412+
* enable this setting to fetch the real client IP from the proxy headers.
413+
*/
414+
'use_reverse_proxy_ip' => false,
415+
416+
/*
417+
* The header used by reverse proxies to forward the real client IP.
418+
* Common values are 'X-Forwarded-For' or 'X-Real-IP'.
419+
*/
420+
'real_ip_header' => 'X-Forwarded-For',
421+
],
410422
```
411423

412424
<a name="authentication-monitoring-views"></a>
@@ -441,7 +453,7 @@ If you discover any security-related issues, please email `[email protected]` i
441453
<a name="chanelog"></a>
442454
## Changelog
443455

444-
The changelog can be found in the `CHANGELOG.md` file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each version of the Laravel User Monitoring package.
456+
The changelog can be found in the `CHANGELOG.md` file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each Laravel User Monitoring package version.
445457

446458
<a name="license"></a>
447459
## License
@@ -456,7 +468,7 @@ The MIT License (MIT). Please see [License File](https://github.com/binafy/larav
456468
<a name="conclusion"></a>
457469
## Conclusion
458470

459-
Congratulations! You have successfully installed and integrated the Laravel User Monitoring package into your Laravel application. By effectively logging and analyzing user activity, you can gain valuable insights that can help you improve your application's user experience and performance. If you have any questions or need further assistance, please refer to the documentation or seek help from the package's GitHub repository. Happy monitoring!
471+
Congratulations! You have successfully installed and integrated the Laravel User Monitoring package into your Laravel application. By effectively logging and analyzing user activity, you can gain valuable insights that can help you improve your application's user experience and performance. If you have any questions or need any more help, please refer to the documentation or ask for help from the package's GitHub repository. Happy monitoring!
460472

461473
<a name="donate"></a>
462474
## Donate

config/user-monitoring.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
* Set to 0 to disable automatic deletion.
9191
*
9292
* To enable automatic deletion, configure Laravel's task scheduling as outlined here:
93-
* https://laravel.com/docs/10.x/scheduling
93+
* https://laravel.com/docs/scheduling
9494
*/
9595
'delete_days' => 0,
9696
],
@@ -132,6 +132,11 @@
132132
* Configuration settings for authentication monitoring.
133133
*/
134134
'authentication_monitoring' => [
135+
/*
136+
* The table name.
137+
*/
138+
'table' => 'authentications_monitoring',
139+
135140
/*
136141
* If enabled, authentication records will be deleted when the associated user is deleted.
137142
*/

0 commit comments

Comments
 (0)