Samouczek — Notification
Tutorial: notifications on your players' phones
You will add "Receive notifications" to a JumPHP application, try it without a phone, then send a notification from your terminal.
Step 1: add the extension
bin/jumphp extension:add my-game jumphp/notification
The engine finds it at boot; its samples land in src/Extensions/Notification/.
Step 2: put the toggle in a form
In forms/Settings.form.yaml (or with $this->build([...])), add one line:
- {class: JumphpExtensions\Notification\NotifyToggle, id: notify, user: player-42, groups: [beta]}
user is your own id for this person (what you will send to); groups are your lists.
Step 3: try it without a phone
On the desktop the toggle is greyed: notifications live in the browser. In your form's enter(), for a test run:
(new \JumphpExtensions\Notification\PhoneSimulator())->attach(\JumphpExtensions\Notification\Notifications::of($this->engine));
bin/jumphp run my-game, click "Receive notifications": it ticks. Set $phone->answer = 'denied' and it says the person refused.
Step 4: write a game test
$scene = $this->game->start(SettingsForm::class);
$scene->click($scene->notify);
$this->game->run(2);
self::assertTrue($scene->notify->checked);
Step 5: ask for the right and the token
On jumphp.net, studio, your project → Notifications: enable them (the administrator approves the notify right of this commit), then
create the token jnt_… (shown once).
Step 6: send from your terminal
bin/jumphp notify:login my-game
bin/jumphp notify my-game --user player-42 "Your turn" "Ada played" --url /play/ --dry-run
bin/jumphp notify my-game --user player-42 "Your turn" "Ada played" --url /play/
bin/jumphp notify:stats my-game
Step 7: let Claude send them
claude mcp add jumphp-notify -- bin/jumphp notify:mcp
Ask "how many beta testers would get a notification?" (notify_dry_run), then "send them: Season 2 is out". A notification to everyone
needs your explicit yes (confirm: true).