Skip to content

Commit 184a28d

Browse files
committed
Update README for Event trigger
1 parent b7455e9 commit 184a28d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Lightweight traffic tracking for CodeIgniter 4
55

66
1. Install with Composer: `> composer require tatter/visits`
77
2. Update the database: `> php spark migrate:latest -n Tatter`
8-
4. Add to controller: `service('visits')->record();`
8+
3. Visits will be recorded automatically by a system event
99

1010
## Features
1111

@@ -47,12 +47,11 @@ comments. If no config file is found in app/Config the library will use its own.
4747
## Usage
4848

4949
If installed correctly CodeIgniter 4 will detect and autoload the class, service, and
50-
config. Use the service to load the class and record the current visit:
50+
config. The library includes an event listening for `post_controller_constructor` to
51+
record page loads. If you prefer to handle them manually you may use the service to load
52+
the class and record the current visit:
5153
* `service('visits')->record();`
5254

53-
**Recommended:** Include this line in `BaseController` in the `initController()`
54-
method so traffic is recorded on every page load.
55-
5655
## Accessing data
5756

5857
This library provides a `VisitModel` and a `Visit` entity for convenient access to recorded

0 commit comments

Comments
 (0)