Installation
tilttek/stickersRequirements
- PHP 8.5 or later, with
ext-mbstringandext-sodium. phil/resource0.1, whoseResourceReferencenames holders and surfaces.tilttek/sets0.1, for sticker sheets and albums.psr/clockandpsr/event-dispatcher: the clock of the placements and the dispatcher of the events, both optional.
Installing
composer require tilttek/stickers
Wiring the library
use Tilttek\Stickers\{Limits, Stickers, StickerSheets};
$stickers = new Stickers(
$catalog, // Contract\StickerCatalog: the stickers of the site
$ownerships, // Contract\OwnershipStore: the stickers each holder owns
$placements, // Contract\PlacementStore: where the stickers are placed
$surfaces, // Contract\SurfacePolicy: which surfaces each holder may use
new Limits(perSurface: 12, perHolder: 500, minScale: 50, maxScale: 200, maxRotation: 45),
$clock, // a PSR-20 clock; the system's in UTC by default
$dispatcher, // a PSR-14 dispatcher, told of each change; null to dispatch nothing
$moderator, // Contract\PlacementModerator, which may hide a new placement; null for none
);
$sheets = new StickerSheets($sets, $ownerships); // $sets: a Tilttek\Sets\Sets
Stickers and StickerSheets keep nothing between two calls, so one instance serves every request of a worker. The
in-memory adapters keep everything in the process, for tests, scripts and a catalogue declared in configuration.