https://github.com/fluffy-factory/user-stats-bundle
Get user stats route :page_with_curl: :bar_chart:
https://github.com/fluffy-factory/user-stats-bundle
easyadmin hacktoberfest statistics symfony user
Last synced: 2 months ago
JSON representation
Get user stats route :page_with_curl: :bar_chart:
- Host: GitHub
- URL: https://github.com/fluffy-factory/user-stats-bundle
- Owner: fluffy-factory
- Created: 2020-10-05T09:08:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-06-20T13:09:08.000Z (almost 3 years ago)
- Last Synced: 2025-09-08T20:59:06.415Z (6 months ago)
- Topics: easyadmin, hacktoberfest, statistics, symfony, user
- Language: PHP
- Homepage:
- Size: 728 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# User stats

## Introduction
You need to require Symfony 4.* or 5.* for use this bundle. (and Easyadmin 3.* for the easier installation)
### :rotating_light: Disclaimer
This bundle retrieves user information. You must ask permission from your users to use this bundle legally. Any negligence in the strict application of the recommended procedures relieves us of all responsibility for their use.
## Installation
```
composer require fluffy-factory/user-stats-bundle
```
## Configuration
You can create your own configuration in `config/packages/fluffy_user_stats.yaml`:
```yaml
user_stats:
exclude_route: ["liip_imagine_filter"]
user_stat_enabled: true
max_month_before_archive: 6
user_stat_max_result: 2000
```
### Entity
Add mixin Class `use UserStats` in your User entity
```php
class User
{
### ADD THIS ###
use UserStats;
...
}
```
Make a database schema update
```
php bin/console d:s:u --force
```
Install assets
```
php bin/console assets:install
```
### Routing
Create routes file `config/routes/fluffy_user_stats.yaml` with the below config:
```yaml
fluffy_user_stats:
resource: "@UserStatsBundle/Controller/UserStatsController.php"
type: annotation
# prefix: /admin
```
### Archive
If you have a lot of users and the data table is getting too big; you can archive your data older than 6 months (by default) in a data table named **user_stats_lines_archives**.
To archive you need to use the command ```make:user:stats:archive```
You can change the number of months archived :
```yaml
# config/packages/fluffy_user_stats.yaml
user_stats:
# number of months before the data is archived
max_month_before_archive: 6
```
## Integration
### Easyadmin 3.*
Add custom actions in your entity configuration
```php
$userStats = Action::new('userStats', 'Statistiques utilisateur')
->linkToRoute('fluffy_user_stats', function (User $entity) {
return [
'id' => $entity->getId()
];
});
return parent::configureActions($actions)
->add(Crud::PAGE_INDEX, $userStats)
->setPermission('userStats', 'ROLE_SUPER_ADMIN');
```