Download the PHP package ernestdefoe/roleplay without Composer

On this page you can find all versions of the php package ernestdefoe/roleplay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package roleplay

Role-Play for Flarum

Play a character, post in-character, and run a card-based tactical game — right inside your Flarum discussions.

Flarum 2.0+

Role-Play turns an ordinary Flarum forum into a home for tabletop-style play. Members create characters, write posts as those characters, and storytellers can run full turn-based combat encounters — with dice, cards, initiative and live HP bars — without anyone leaving the thread.

It touches no core tables (everything lives in its own rp_* tables) and is free and MIT-licensed.


Three features, one extension

🎭 Characters

Members manage their cast at /characters ("My Characters" in the account menu): a name, an accent colour, an optional avatar and bio. Characters are yours; archive them any time and their old posts keep their identity.

💬 Post in-character

When replying, pick "Post as …" in the composer and your reply is authored as that character — its coloured badge and name replace your own, with a quiet "Played by you" underneath so nothing is hidden. Perfect for narrative threads where several people each speak as their characters.

⚔️ A tactical card game

This is where Role-Play goes further than any other Flarum RP add-on. Build a deck of cards, then run encounters — turn-based fights that play out live in the discussion sidebar.


The deck builder

At /deck ("My Deck" in the account menu) each member crafts cards — abilities, items, spells and enemies — each with dice formulas the game engine actually rolls:

Dice expressions are validated server-side — a malformed formula is rejected, never silently ignored.


Running an encounter

Any member can start an encounter inside a discussion and becomes its storyteller (GM). From the tracker in the sidebar you:

  1. Build the field — add party members and foes by hand, spawn a foe straight from an enemy card (its HP and defense seed automatically), and let players join with one of their own characters.
  2. Roll initiative & start — every combatant rolls 1d20 + agility; the tracker sorts them into turn order.
  3. Play it out — on each turn the active combatant plays a card at a target. The engine rolls to-hit vs. defense, rolls damage on a hit (×2 on a crit), and updates HP. A rolling action log narrates every play — hits, misses and crits.
  4. Advance until one side is down — a Victory / Defeat banner appears, and the GM ends the encounter.

The tracker shows the initiative order, colour-coded HP bars (green party / red foes), the active turn, and adapts its controls to who's looking — the GM drives the fight; a player only acts on their own character's turn.

Live for the whole table

When flarum/realtime is installed, every play, turn and HP change is broadcast over WebSocket — the whole table sees the fight update instantly, no refresh. Without realtime, the tracker falls back to a lightweight poll, so it still stays in sync.


Installation

That's it — the six rp_* tables are created automatically on enable. Then:

Requirements


How the dice work

The engine (src/Game.php) is a small, pure core:

Step Rule
Dice Any XdY+Z expression, e.g. 2d6+1, 1d20, 3d8-2
Initiative 1d20 + agility, highest goes first
To-hit Attack total ≥ target defense (defense 0 = always hits)
Crit A natural maximum on any attack die → double damage
Down A combatant at 0 HP is out; turns skip them

Building from source

The PHP runs as-is; the front-end compiles with the Flarum webpack toolchain:


License

MIT © Ernest Defoe. Free to use, fork and build on.


All versions of roleplay with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
flarum/core Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ernestdefoe/roleplay contains the following files

Loading the files please wait ...