On the PHP Framework Interop Group site (the maintainer of PSRs), there is a draft PSR-8 Huggable Interface:
namespace Psr\Hug;
/**
* Defines a huggable object.
*
* A huggable object expresses mutual affection with another huggable object.
*/
interface Huggable
{
/**
* Hugs this object.
*
* All hugs are mutual. An object that is hugged MUST in turn hug the other
* object back by calling hug() on the first parameter. All objects MUST
* implement a mechanism to prevent an infinite loop of hugging.
*
* @param Huggable $h
* The object that is hugging this object.
*/
public function hug(Huggable $h);
}
The draft is quite short but does not provide any examples of implementation. What is the purpose of implementing this interface?
I started an implementation here: https://github.com/dave1010/php-fig-psr-8
It's not quite finished (contributors welcome!) but already useful if you need a PSR-8 implementation in your projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With