Skip to content
VitiosumPublic

About

RunRank, the Medal Ceremony: a race pace calculator on the Clever Cloud PHP runtime (Laravel 12, stateless), with an engraved medal and an enamelled crest per rank.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RunRank, the Medal Ceremony — PHP runtime (Laravel) on Clever Cloud

A medal ceremony in a marble hall. You sign the race register (5 km, 10 km, half or marathon, and your time); Laravel homologates it on the Clever Cloud PHP runtime, engraves your time and pace on a medal struck in your rank's metal, mounts your enamelled crest on the podium and places you on the nine-step stair of honour, from Iron to Challenger, with the time you need for the next step. Every result comes with the jury's minutes, read from PHP itself: the request received, the calculation, the PHP version and SAPI, the PHP-FPM worker that answered, the processing time and the instance. No database, no add-on, no session stored on the server: any instance can answer any request.

RunRank run locally: 45:30 is entered for a 10 km in the race register, Laravel answers with the Platinum medal on the podium, then the jury's minutes show the POST request, the calculation, the PHP version and the worker that answered

The result page, run locally: a 10 km in 45:30 gives a Platinum medal engraved 45:30 and 4:33 per km, hung over the podium with the Platinum crest; the jury aims at Diamond, 45:00

The race register on a phone, run locally: 10 km circled in ink, 0 h 45 min 30 s, and the button to homologate the time

Run it yourself. The hosted demo was taken down after the presales review (November 2026). The steps in Deploy on Clever Cloud recreate it from scratch in about 5 minutes.

Get certified. This demo runs on Clever Cloud. To deploy your own apps the same way, get certified at the Clever Cloud Academy.

What the PHP runtime does here

In the ceremony What runs What you see
The register GET /, served by Apache and PHP-FPM; Composer installed Laravel 12 at build because composer.json is at the repo root The sheet number is the PID of the PHP worker that served the form; the clerk's note under the title gives the PHP version, the SAPI, the processing time and the instance
Homologation POST /result: Laravel validates the event (5k, 10k, 21k, 42k) and the time (45, 45:30, 1:45:30), RunController computes pace, rank and score The medal (time and pace engraved), the crest on the podium, the brass plaque, the next step
The jury's minutes App\Support\Platform::runtime() reads PHP_VERSION, PHP_SAPI, getmypid(), the time since LARAVEL_START and the peak memory One line per fact, under a rubber stamp dated by the server. "Rejouer la requête" sends the same entry again: another worker, or another instance, answers
Web root clevercloud/php.json sets "webroot": "/public" Apache serves public/index.php, Laravel's front controller; nothing else in the repo is reachable
PHP version CC_PHP_VERSION composer.lock holds Symfony 8 components that need PHP 8.4 or later
Session SESSION_DRIVER=cookie, encrypted with APP_KEY The CSRF token and the "Format invalide" message travel in the cookie: no database, no add-on
Scaling 1 to 2 instances behind the load balancer Stateless: every instance shares the same APP_KEY, so no sticky session is needed
Clever frame The platform variables, read by App\Support\Platform The "Running on Clever Cloud" panel (app, instance, commit, deployment; "Local" outside the platform) and the Clever Cloud Academy medal in its display case

The rank comes from the pace alone (RunController::RANKS). Each step of the stair has its own crest, richer as you climb:

Pace per km Rank Crest
≤ 3:00 Challenger Sun, crown, wings and rays
≤ 3:30 Grandmaster Eight-point star, crown and wings
≤ 4:00 Master Torch and crown
≤ 4:30 Diamond Faceted lozenge and a gem
≤ 5:00 Platinum Cross, laurels
≤ 5:30 Gold Star, laurels
≤ 6:30 Silver Two chevrons
≤ 7:30 Bronze Chevron
slower Iron Bar

The "Top N %" index is a score, not a population statistic: a reference pace for the distance (4:00 for 5K, 4:15 for 10K, 4:30 for the half, 5:00 for the marathon) divided by your pace, times 50, capped at 0–100. The half marathon counts as 21.1 km, the marathon as 42.195 km. The next step shows the time to beat on the same distance (10 km at 4:30 per km: 45:00).

Deploy on Clever Cloud

You need clever-tools (clever login done) and the ID of the organisation that will own the resources (orga_…, shown in the Console). Run the commands from the repo root: clever create links the folder to the new app.

# 1. The app and its size
clever create --type php runrank --org <org_id> --region par
clever scale --min-flavor nano --max-flavor XS --min-instances 1 --max-instances 2

# 2. No add-on: sessions are cookies, nothing is stored

# 3. Variables (the key is generated in the command and never printed)
clever env set APP_KEY "base64:$(openssl rand -base64 32)"
clever env set APP_ENV production
clever env set APP_DEBUG false
clever env set SESSION_DRIVER cookie
clever env set CACHE_STORE file
clever env set CC_PHP_VERSION 8.5
clever env set CC_HEALTH_CHECK_PATH /

# 4. Deploy
clever deploy
clever open

The web root comes from clevercloud/php.json, already in the repo. There is no .env in the repo: every setting above is an environment variable of the app.

Variables

Variable Set by Role
APP_KEY you, generated in the command Laravel's encryption key: encrypts the session cookie. Same value on every instance
APP_ENV you production
APP_DEBUG you false: no stack trace in the page
SESSION_DRIVER you cookie. Laravel's default is database, which would need a table
CACHE_STORE you file. Laravel's default is database
CC_PHP_VERSION you 8.5 (Symfony 8 components need 8.4 or later)
CC_HEALTH_CHECK_PATH you /: the register answers 200 without any dependency
CC_APP_NAME, APP_ID, INSTANCE_NUMBER, INSTANCE_TYPE, CC_PRETTY_INSTANCE_NAME, CC_COMMIT_ID, CC_DEPLOYMENT_ID the platform Shown in the "Running on Clever Cloud" panel and in the jury's minutes. No other variable is ever printed

Routes

Route What it does
GET / The race register, the stair of honour, how the jury works
POST /result distance (5k, 10k, 21k, 42k) and time (45, 45:30 or 1:45:30): the medal, the podium, the minutes. An unreadable time sends you back to the register with the error
GET /up Laravel's health route: 200 when the app boots

Code tour

app/Http/Controllers/RunController.php   the logic: parse the time, pace per km, rank (RANKS), score, next step
app/Support/Platform.php                 the platform variables shown, and the facts read from PHP (version, SAPI, PID, time, memory)
app/Support/RankStyle.php                how each rank looks: crest enamel, medal metal, the jury's remark
routes/web.php                           GET / and POST /result
resources/views/home.blade.php           the register, the clerk's note, how the jury works
resources/views/result.blade.php         the medal over the podium, the verdict, the jury's minutes
resources/views/partials/                crest, medal and ribbon (SVG), stair of honour, Academy display case
resources/views/layouts/ceremony.blade.php   Clever header, "Running on Clever Cloud" panel, footer
public/ceremony.css, public/ceremony.js  the universe's styles and the small form script
public/cc-brand.css                      Clever Brand Kit, copied as is
clevercloud/php.json                     web root /public

The pages load their fonts from Google Fonts (Cinzel for the engraving, Plus Jakarta Sans and JetBrains Mono from the brand kit) and two static files from public/: no front-end build. Medals, crests and the marble are drawn in SVG. The interface is in French.

Run locally

composer install
APP_KEY="base64:$(openssl rand -base64 32)" SESSION_DRIVER=cookie CACHE_STORE=file \
  php artisan serve --port=8401 --no-reload
# → http://localhost:8401

PHP 8.4 or later. Without a .env file, the variables on the command line are the whole configuration, as on Clever Cloud. The tests run with php artisan test (or vendor/bin/phpunit); they bring their own throwaway key.

License

MIT, see LICENSE.

About

RunRank, the Medal Ceremony: a race pace calculator on the Clever Cloud PHP runtime (Laravel 12, stateless), with an engraved medal and an enamelled crest per rank.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages