navarr/hugger

PSR-8 Implementation

Maintainers

Details

github.com/navarr/hugger

Source

Issues

Fund package maintenance!
navarr

dev-main / 1.0.x-dev 2021-11-30 13:40 UTC

This package is auto-updated.

Last update: 2024-10-29 06:25:12 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License
Tests Code Coverage

This is an implementation of PSR-8. This package includes a Hugger class (which is always happy to hug), as well as a GroupHuggableTrait, so you can add hugging functionality to any class.

Installation

Until such time as PSR-8 is un-abandoned, you need to install both my own implementation of its interfaces, as well as this hugging library.

composer require navarr/psr-hug-interfaces:@dev navarr/hugger:@dev

Usage

class ClassThatWantsToHug
{
    use \Navarr\Hugger\GroupHuggableTrait;
}

$hugger = new ClassThatWantsToHug();
$otherHugger = new \Navarr\Hugger\Hugger();

$hugger->hug($otherHugger);
// Hugger will call $otherHugger->hug($other)

$hugger->groupHug([$otherHugger]);