PHPackages                             kennofizet/workpoint-backend - 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. kennofizet/workpoint-backend

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

kennofizet/workpoint-backend
============================

Workpoint Record backend for Laravel — record workpoint events with check rules, zone/server scoped via packages-core

01↓100%PHP

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/kennofizet/point-backend)[ Packagist](https://packagist.org/packages/kennofizet/workpoint-backend)[ RSS](/packages/kennofizet-workpoint-backend/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Workpoint Backend
=================

[](#workpoint-backend)

Laravel package to **record workpoints** (points) for subjects (e.g. users) with configurable rules. Zone-scoped via **packages-core**. Use the `HasWorkpointRecords` trait to record points and expose top ranking + rules APIs.

---

Requirements
------------

[](#requirements)

- PHP 8.2+, Laravel 12.x
- **kennofizet/packages-core-backend** (zone scoping + API auth)

---

Install
-------

[](#install)

```
composer require kennofizet/workpoint-backend
php artisan vendor:publish --tag=workpoint-config
php artisan vendor:publish --tag=workpoint-migrations
php artisan migrate
```

**Optional .env** (defaults are fine for most):

```
WORKPOINT_TABLE=workpoint_records
WORKPOINT_PERIOD_TOTALS_TABLE=workpoint_period_totals
WORKPOINT_ZONE_CASES_TABLE=workpoint_zone_cases
WORKPOINT_API_PREFIX=workpoint
WORKPOINT_USE_PERIOD_TOTALS_TABLE=true
```

---

Config
------

[](#config)

- **config/workpoint.php** — Tables, API prefix, period totals, event/listeners, rules map.
- **config/workpoint\_cases.php** — Action keys (e.g. `task_completed_on_time`) with `points`, `check`, `period`, `cap`, `descriptions` (vi/en). Per-zone overrides stored in DB; defaults from this file.

---

Usage in code
-------------

[](#usage-in-code)

**1. Add trait to the model that earns points (e.g. User):**

```
use Kennofizet\Workpoint\Traits\HasWorkpointRecords;

class User extends Authenticatable
{
    use HasWorkpointRecords;
}
```

**2. Record workpoints** (action key must exist in `workpoint_cases.php`):

```
$user->recordWorkpoint('app_first_visit_day');                    // no target
$user->recordWorkpoint('task_completed_on_time', $task);          // with target
$user->recordWorkpoint('task_accepted_sla', $task, ['sla' => 24]); // with payload
```

Returns `WorkpointRecord` or `null` if the rule disallows (e.g. already earned for that target/period).

**3. Query records:**

```
$user->workpointRecords;
$user->getWorkpointRecordsByPeriod('week');
```

---

API
---

[](#api)

All under `{packages-core.api_prefix}/{workpoint.api_prefix}/` (e.g. `api/knf/workpoint`). Requires `X-Knf-Token`; zone from `X-Knf-Zone-Id`.

MethodEndpointDescriptionGET`top?period=day|week|month|year&limit=10`Top subjects by points in period (zone-scoped).GET`rules?language=vi|en`Merged rules (default + zone overrides). Returns `rules`, `language`, `isManager`.POST`rules/save`Save one zone case override (manager). Body: `zone_id`, `case_key`, `points`, `check`, `period?`, `cap?`, `descriptions?`.POST`rules/reset`Reset zone rules to default: delete overrides and clone from config (manager). Body: `zone_id`.---

Summary
-------

[](#summary)

StepActionInstall`composer require kennofizet/workpoint-backend`Config`php artisan vendor:publish --tag=workpoint-config`Migrations`php artisan vendor:publish --tag=workpoint-migrations` then `php artisan migrate`Model`use HasWorkpointRecords;` → `$model->recordWorkpoint('action_key', $target)`More in config file comments (events, listeners, rules).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance63

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/29be9653cc5f9429ea5227b6069c808999a577e1d3112a1f2da1f2e377c3cd88?d=identicon)[kennofizet](/maintainers/kennofizet)

---

Top Contributors

[![phuongdpreg](https://avatars.githubusercontent.com/u/183365267?v=4)](https://github.com/phuongdpreg "phuongdpreg (15 commits)")

### Embed Badge

![Health badge](/badges/kennofizet-workpoint-backend/health.svg)

```
[![Health](https://phpackages.com/badges/kennofizet-workpoint-backend/health.svg)](https://phpackages.com/packages/kennofizet-workpoint-backend)
```

###  Alternatives

[bertptrs/phpstreams

A streams library for PHP based on the Java 8 Streams API.

883.2k](/packages/bertptrs-phpstreams)[cheprasov/php-parallel

The class allows you to run multiple operations parallel in different processes and send results to the main process. Useful if you need to run multiple independent operations simultaneously, instead of sequential execution, or if you run several independent queries, for example, queries to different data bases

1712.5k5](/packages/cheprasov-php-parallel)

PHPackages © 2026

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