A support package that provides flexible and reusable helper methods and traits for commonly used functionalities.
The package requires PHP 8.0+ and follows the FIG standard PSR-4 to ensure a high level of interoperability between shared PHP code and is fully unit-tested.
- Easy register an event listener with the dispatcher.
- Easy begin the process a mailable.
- Easy to validate your application's incoming data.
- Allowing you to subscribe and listen to various events that occur within your application easily.
- And much more!
Install the package with the below command:
composer require focela/support
In this section, we'll show how you can make use of the available traits.
- 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');
}
}
- 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();
}
}
I hope you find this useful. If you have any questions, please create an issue.
If you discover any security related issues, please email opensource@focela.com instead of using the issue tracker.
This software is released under the BSD 3-Clause License. Please see the LICENSE file or https://www.focela.com/license for more information.
Thanks goes to these wonderful people (emoji key):
Son Tran Thanh 💻 📝 |
This project follows the all-contributors specification. Contributions of any kind welcome!