focela/support

Flexible helper methods & traits for commonly used functionalities

v10.0.0 2024-06-27 15:38 UTC

README

Build Status Total Downloads Latest Version on Packagist Software License

A support package that provides flexible and reusable helper methods and traits for commonly used functionalities.

Installation

composer require focela/support

Quick Start

In this section, we'll show how you can make use of the available traits.

EventTrait

The EventTrait makes it easy to add dispatching abilities to your classes.

<?php

use Focela\Support\Traits\EventTrait;

class FooRepository
{
    use EventTrait;

    public function foo()
    {
        $this->fireEvent('foo');
    }
}

RepositoryTrait

The RepositoryTrait makes it easy to create new instances of a model and to retrieve or override the model during runtime.

use Focela\Support\Traits\RepositoryTrait;

class FooRepository
{
    use RepositoryTrait;

    public function foo()
    {
        return $this->createModel();
    }
}

Contributing

We encourage and support an active, healthy community of contributors — including you! Details are in the contribution guide and the code of conduct. The support maintainers keep an eye on issues and pull requests, but you can also report any negative conduct to opensource@focela.com. That email list is a private, safe space; even the support maintainers don't have access, so don't hesitate to hold us to a high standard.

Released under the MIT License.