Skip to content

Installation

tilttek/homebrew-hub
composer require tilttek/homebrew-hub

The package needs PHP 8.5 or later, psr/clock, whose clock gives the services the time, and tilttek/table-rules, which keeps the rules of the tables that adopt a homebrew.

An application gives HomebrewHub:

  • a Contract\HomebrewStore that keeps the homebrews in its database and searches them;
  • a PSR-20 ClockInterface, such as the NativeClock of symfony/clock;
  • a Contract\HomebrewObserver, to send its messages, or nothing.

It gives Adoption the same HomebrewStore, and:

  • a Contract\SubscriptionStore that keeps which homebrews each table follows;
  • the TableRules service of tilttek/table-rules, wired to the application's rulebook store;
  • the same clock;
  • a Contract\Transactions that runs the writes of an adoption in one database transaction — Store\NoTransactions runs them as they come, for tests;
  • an observer, or nothing.

The services keep no state between calls, so one instance of each serves every request of a long-running worker.

Store\InMemoryHomebrewStore and Store\InMemorySubscriptionStore keep them in memory, for tests.