PHPackages                             littlecubiclegames/quests - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. littlecubiclegames/quests

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

littlecubiclegames/quests
=========================

Quest Component

1.3.2(4y ago)57.8k↓50%1[1 issues](https://github.com/littlecubiclegames/quests/issues)MITPHPPHP ^7.2||^8CI failing

Since Apr 6Pushed 4y ago4 watchersCompare

[ Source](https://github.com/littlecubiclegames/quests)[ Packagist](https://packagist.org/packages/littlecubiclegames/quests)[ RSS](/packages/littlecubiclegames-quests/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (11)Versions (9)Used By (0)

[![Build Status](https://camo.githubusercontent.com/337321a3f2d24d1233b0fa42786397f22b084692c6b484192506a99f75e49c9d/68747470733a2f2f7472617669732d63692e6f72672f6c6974746c6563756269636c6567616d65732f7175657374732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/littlecubiclegames/quests)

Quest System
============

[](#quest-system)

Installation
------------

[](#installation)

`composer require littlecubiclegames/quests`

Usage
-----

[](#usage)

If you are not using Silex have a look at the `ServiceProvider` to see how to initialize all the services and to see which event listeners need to be registered. You will have to implement `LittleCubicleGames\Quests\Initialization\QuestBuilderInterface` which will create a Entity class out of the quest definition data. You might also want to overwrite the currently used `ArrayStorage` with you own persistent storage.

Inside your Silex application you can:

```
$app = new \Silex\Application();
$app->register(new \LittleCubicleGames\Quests\ServiceProvider(), [
    'cubicle.quests.quests' => [], // load your quests (see quest definition below)
    'cubicle.quests.slots' => [], // if you use the `StaticSlotLoader` define your quest slots here (see slot definition below)
    'cubicle.quests.initializer.questbuilder' => null, // define your QuestBuilder
]);

// In your app during boot, fetch current user id and initialize the quests
$userId = null;
$app['cubicle.quests.initializer']->initialize($userId);

// In your controller advance quests as desired
$app[''cubicle.quests.advancer']->startQuest($questId, $userId);
```

Quest Components
----------------

[](#quest-components)

#### Task

[](#task)

Quests can have a list of tasks which are required to be completed before the quest can be finished (e.g. User needs to login 5x). A quest can have multiple tasks. The boolean operators `AND` and `OR` can be used to combine tasks. These operators can also be nested (e.g. User needs to login 5x OR The Sun is shining).

#### Trigger

[](#trigger)

To decide which quest will be started after another quest was finished trigger conditions can be defined. The first quests which matches all the trigger conditions will then be started.

#### Slot

[](#slot)

With slots it is possible to limit the amount of quests open at the time. Each slot allows one open quest. The availability of quests can be limited with a start and end date which can be useful for limited events. Slots are tied to a registry.

#### Progress Listener

[](#progress-listener)

Every quest that gets started automatically registers for all events necessary to track the progress. This happens whenever a quest gets started or during a request you can register individual quests that you load from you database storage via `ProgressListener::registerQuest(QuestInterface $quest)`. Quests which upon progress change get completed, automatically change state into the `completed` state. You can use the `QuestInitializer` to manually register all quests.

#### Task Completion Guard

[](#task-completion-guard)

The `IsCompletedListener` is a guard to make sure the quest can only change state to the `completed` state if the task are all finished.

#### No Reward Listener

[](#no-reward-listener)

Some quests might not have any reward for completion. Such quests will automatically be advanced from the `completed` to the `closed` state.

#### Rewards

[](#rewards)

Quests can have multiple rewards. Every reward type needs to have a Collector which implements the `CollectorInterface`. Multiple rewards for one quest can be combined with the `MultipleRewards` class. Rewards itself must only contain a type. Everything else should be customized to the needs of the collector.

#### Log

[](#log)

The quest log allows logging of every state change. It can serve two purposes:

- it makes the debug process easier because we know exactly when things happened
- it can be shown to the user as quest activity log

Quest States
------------

[](#quest-states)

#### Available

[](#available)

The initial state the quest reaches once it leaves the quest pool.

#### In Progress

[](#in-progress)

The quest was started and the user is working on completing all tasks.

#### Completed

[](#completed)

The tasks in this quests are completed

#### Finished

[](#finished)

The tasks are completed and the reward, if any, was collected. The user is done with the quest and it should not be displayed anymore.

#### Rejected

[](#rejected)

The user or the system decided to abort or reject the quest. The user is done with the quest and it should not be displayed anymore.

Slot definition data (using the static slot loader)
---------------------------------------------------

[](#slot-definition-data-using-the-static-slot-loader)

```
[
	{
		"id": "some-id",
		"registry": "reference to the registry id",
		"start": "2017-01-01",
		"end": "2018-01-01"
	}
]
```

Note: start and end are optional.

Quest definition data
---------------------

[](#quest-definition-data)

```
{
	"id": "some-id",
	"task": {
		"operator": "and",
		"children" : [
			{
				"id": "task-id-1",
				"type": "finish-quests",
				"operator": "less-than",
				"value": 10
			},
			{
				"operator": "or",
				"children": [
					{
						"id": "task-id-2",
						"type": "finish-quests",
						"operator": "less-than",
						"value": 5
					},
					{
						"id": "task-id-3",
						"type": "finish-quests",
						"operator": "equal-to",
						"value": 2
					}
				]
			}
		]
	},
	"rewards": [
		{
			"type": "reward-type"
		}
	]
}
```

Creating your own components
----------------------------

[](#creating-your-own-components)

- [Create a task](./docs/CreateATask.md)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~146 days

Recently: every ~218 days

Total

7

Last Release

1700d ago

PHP version history (2 changes)1.0PHP ^7.2

1.3.1PHP ^7.2||^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/2969e5fd81aa79b482a247226409a0b55ed82c4587d40264633425b6b4a22a21?d=identicon)[glaubinix](/maintainers/glaubinix)

---

Top Contributors

[![glaubinix](https://avatars.githubusercontent.com/u/442056?v=4)](https://github.com/glaubinix "glaubinix (73 commits)")

---

Tags

gamegame-frameworkquest-system

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/littlecubiclegames-quests/health.svg)

```
[![Health](https://phpackages.com/badges/littlecubiclegames-quests/health.svg)](https://phpackages.com/packages/littlecubiclegames-quests)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[setono/sylius-feed-plugin

Plugin to generate feeds within the Sylius ecommerce platform

26458.2k](/packages/setono-sylius-feed-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
