Search by

phil / reputation

phil

Recognize members who help others without karma games: points only from peers, a daily cap, exact withdrawal, serial votes annulled and no downvotes.

0.1.0-alpha 2026-12-02 22:00 UTC

This package is auto-updated.

Last update: 2026-12-03 01:33:06 UTC


README

Members earn reputation only from what their peers recognize: points under a daily cap, a floor no one falls under, a recognition withdrawn that takes back exactly what it gave, serial voting annulled for the day, no downvotes, and a readable history; the points feed trust levels rather than open rights alone.

phil/reputation gives an application — a community of questions and answers, a course platform, a forum — a measure of recognized help. Peers recognize a contribution — found it helpful, accepted it as the answer, approved an edit — and its author earns the points of that kind of recognition. Nothing takes points away on a peer's word: there are no downvotes, a peer who finds a contribution not helpful sends its author a private signal worth no points, and reports go to the moderation. Only a moderator's correction, with a reason shown to the member, lowers a reputation.

The points are never stored: they are read from a ledger, day after day. Each day adds its capped points up to the daily cap, then its other points, such as an accepted answer; the total never falls under the floor. A recognition withdrawn therefore takes back exactly what it gave, and lets one the cap had held back count. When one peer recognizes the same member too often in a day, the day's recognitions between them are annulled and the moderation is told, to warn the voter: no sanction without a person deciding.

Each member reads their history, newest first: what earned or cost points and how many each counted, never who recognized them. The reputation joins the activity of phil/trust-levels as one more metric, so that a level can ask for recognized help next to counts of acts: the ladder decides what it opens.

It is a plain PHP library on psr/clock, psr/event-dispatcher, symfony/uid and phil/trust-levels. The ledger lives in a store behind one interface, in memory for tests and scripts. It holds no state between calls and runs in a worker. The pages, the database tables and the moderation of reports belong to the application or to a bundle.

Status

Part State
Rules: kinds of recognition and their points, starting points, floor, daily cap, serial voting threshold, time zone; read from configuration, with bounds and a fuzz target Implemented and tested
Recognitions given once per peer, kind and subject, withdrawn exactly; the ledger read day after day under the cap and the floor Implemented and tested
Serial voting annulled for the day and dispatched for the moderation Implemented and tested
Corrections by a moderator with a reason; private "not helpful" signals Implemented and tested
Readable history without the peers; standing with what is left of the day's cap Implemented and tested
Forgetting a voter or a member when their account is erased Implemented and tested
The reputation as a metric of phil/trust-levels Implemented and tested
In-memory store Implemented and tested
A Symfony bundle: services from configuration, Doctrine store, cached standings, the erasure of an account Not written

Documentation

Document What it covers
Installation Requirements, installing, building the service.
Rules The kinds of recognition, the starting points, the floor, the cap, the threshold, the time zone, and the format of the configuration.
The ledger Recognizing and withdrawing, how the points are read, serial voting, corrections, "not helpful", the history, forgetting an account.
Trust levels Feeding the reputation to phil/trust-levels, and showing it.
Extension points The port, events and arguments an application chooses or replaces.
Testing The package's tests, fuzz target and benchmark, and how to test code that gives reputation.
Reference Every public type, with its role.

Quick start

composer require phil/reputation
use Phil\Reputation\InMemoryReputationStore;
use Phil\Reputation\Reputation;
use Phil\Reputation\ReputationRules;
use Symfony\Component\Clock\NativeClock;

$reputation = new Reputation(ReputationRules::default(), new InMemoryReputationStore(), new NativeClock());

$reputation->recognize('helpful', 'member-12', 'member-7', 'answer:42');  // member-7: 1 → 11
$reputation->recognize('accepted', 'member-3', 'member-7', 'answer:42');  // 11 → 26, outside the daily cap
$reputation->retract('helpful', 'member-12', 'member-7', 'answer:42');    // 26 → 16

$reputation->pointsOf('member-7');      // 16
$reputation->historyOf('member-7');     // newest first, without the peers

Requirements

PHP 8.5 or later with ext-mbstring.

Contributing

Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.

License

MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.