GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - TiltTek/referrals: Reward members who bring friends, in points and never in money, paid once when the newcomer really plays, capped and guarded against self-referral.

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
doc
doc
 
 
src
src
 
 
tests/Unit
tests/Unit
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.fr.md
README.fr.md
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
composer-dependency-analyser.php
composer-dependency-analyser.php
 
 
composer.json
composer.json
 
 
phil-dev.php
phil-dev.php
 
 

Repository files navigation

tilttek/referrals

Referrals rewarded in points, on both sides, once the newcomer really plays, with a cap per referrer.

tilttek/referrals lets a member share a code — in a link the application builds — and rewards them, and the friend who joined through it, in points of tilttek/points: never money, a commission or a discount. The reward waits for the newcomer's first real action — a game played, a character sheet published —, which the application tells through a port, never the sign-up itself, so that an account created only to collect points brings nothing. A referrer is rewarded for ten referrals by default, ever; past the cap, the newcomer still receives their points.

The guards on exchanges of tilttek/exchange hold for referrals too: a member never refers themselves, nor their other account when the application tells two accounts belong to one person; a referrer whose account is too new waits, and only a member who joined recently can be referred, each guard on dates off until the application sets it. The code is random and tells nothing of its member.

The points are given once, whatever happens: each side's movement is written under a key built from the referral's random identifier, which the ledger writes once, and the referral is settled in one step of the store that the cap holds through. Erasing a member leaves no code and no referral that links them to anyone.

It is for a community that wants its members to bring friends without turning friendship into a sale. It is a plain PHP library whose dependencies are tilttek/points, tilttek/exchange, phil/resource and psr/clock.

Status

Part State
Referrals: code, referral, reward, reading, cap, erasure Implemented and tested
ReferralCode, ReferralId, Referral, Terms, FirstAction Implemented and tested
Contract\FirstActions, Contract\SamePerson, Contract\ReferralStore, with their defaults Implemented and tested
Store\InMemoryReferralStore Implemented and tested
A store on Doctrine DBAL, and a Symfony bundle Not started

Documentation

Document What it covers
Installation Requirements, installing and wiring.
Referring and rewarding Codes, guards, the first action, the reward paid once, the cap, reading, erasing.
Extension points The store, the first actions, the same-person signal, joining dates, terms.
Exceptions ReferralsException and its exceptions, with their messages.
Testing The library's tests, and testing code that refers members.
Reference Every public type, with its role.

Quick start

composer require tilttek/referrals
use Tilttek\Referrals\Referrals;
use Tilttek\Referrals\Store\InMemoryReferralStore;

$referrals = new Referrals(new InMemoryReferralStore(), $points, $firstActions, $clock);

$code = $referrals->code($member);              // put in the link the member shares
$referrals->refer($code->value, $newcomer);     // when the newcomer joins through it
$referrals->reward($newcomer);                  // when the newcomer plays a first game: 100 and 50 points

Requirements

PHP 8.5 or later.

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 Tilttek project. See LICENSE.

About

Reward members who bring friends, in points and never in money, paid once when the newcomer really plays, capped and guarded against self-referral.

Topics

communitygamificationinvitationsphppointsreferralstilttek

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.