Feature · Engagement

Gamification

XP, levels, achievements, prizes and leaderboards for Laravel apps, recorded as structured activity your app can analyse.

PHP
XP, achievements and a leaderboardLive · seeded
Y

Your profile

Seeded player, playing live.

140 total XP0 / 4 achievements#4 on the leaderboard
  • Build XPLv 1 · Novice

    60 of 100 XP to level 2, Apprentice

  • Review XPLv 1 · Novice

    80 of 100 XP to level 2, Apprentice

  • Docs XPLv 1 · Novice

    0 of 100 XP to level 2, Apprentice

Event stream

  1. Each award fires an event, as XpAwarded and AchievementUnlocked do in the package.

Leaderboard

#PlayerXPAchievements
1
M
Mara
7503
2
T
Teo
6002
3
I
Iris
4902
4
Y
You
1400
5
S
Sol
600

Your achievements

  • Shipped itLocked. Reach Apprentice in Build XP.
  • Second pair of eyesLocked. Reach Apprentice in Review XP.
  • Wrote it downLocked. Reach Apprentice in Docs XP.
  • Build expertLocked. Reach Expert in Build XP.

Take an action to earn XP. Cross a level threshold and its achievement unlocks itself; watch your rank move.

What ships today

Everything below is in laravel-fun-lab now, behind one facade: LFL.

XP buckets with levels

Each GamedMetric is its own XP bucket with level thresholds, and a profile totals XP across them. MetricLevelGroups combine metrics with weights for a composite level.

Achievements that unlock themselves

Attach an achievement to a level and reaching that level grants it, once. Grant any achievement directly with LFL::grant(), with a reason and a source recorded.

Prizes with inventory

Virtual, physical, feature-unlock or custom prizes, granted the same fluent way. Give a prize an inventory and a grant fails once it runs out.

Leaderboards

LFL::leaderboard() ranks by XP, achievements or prizes, all time or daily, weekly or monthly, and leaves out profiles that opted out unless you ask.

Engagement analytics

LFL::analytics() queries the award log: counts, totals, active users, achievement completion rate and time series, filtered by type, source or period.

Every award is an event

XpAwarded, AchievementUnlocked and PrizeAwarded are Laravel events you can listen to, and opt-in broadcasting sends them on private channels. You bring the broadcast driver.

How it fits

The engine is PHP. The surfaces are react-fancy primitives (Progress, Stat, StatList, Table, Avatar), so any React page can render a profile or a board from the facade's data.

Install

  1. particle-academy/laravel-fun-labPHP
    composer require particle-academy/laravel-fun-lab

The packages

See it on a real board

This site's leaderboard ranks its players by XP with LFL::leaderboard(). Then read the package to put XP in your own app.