Installation
tilttek/homebrew-hubcomposer 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\HomebrewStorethat keeps the homebrews in its database and searches them; - a PSR-20
ClockInterface, such as theNativeClockofsymfony/clock; - a
Contract\HomebrewObserver, to send its messages, or nothing.
It gives Adoption the same HomebrewStore, and:
- a
Contract\SubscriptionStorethat keeps which homebrews each table follows; - the
TableRulesservice oftilttek/table-rules, wired to the application's rulebook store; - the same clock;
- a
Contract\Transactionsthat runs the writes of an adoption in one database transaction —Store\NoTransactionsruns 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.