kanekescom/laravel-helperia

Helper for rapid Laravel development improvements


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Helper for rapid Laravel development improvements. This library is a function and class to help improve Laravel development.

Support us

Want to provide tangible support? Use the following platform to contribute to open-source software developers. Every contribution you make is a significant boost to continue building and enhancing technology that benefits everyone.

We highly appreciate you sending us a few cups of coffee to accompany us while writing code. Super thanks.

Installation

You can install the package via composer:

composer require kanekescom/laravel-helperia

Usage

HasMethodCaller

Make your class return the functionality of another class. This is useful when you want your logic to be returned as another class, Laravel Collection for example.

Here's an example of how to use it to make your classes feel like Laravel Collections.

use Kanekescom\Helperia\Traits\HasMethodCaller;

class MyClass
{
    use HasMethodCaller;

    protected $class;

    public function __construct($array = [])
    {
        $this->class = collect($array);
    }
}

or use ClassExtender instead

ClassExtender

use Kanekescom\Helperia\Support\ClassExtender;

class MyClass extends ClassExtender
{
    public function __construct($array = [])
    {
        $this->class = collect($array);
    }
}

Get Methods of Class

Get the methods that a class has based on its visibility type. Returned as Laravel Collection.

Get public methods

method_public(MyClass::class);

Get protected methods

method_protected(MyClass::class);

Get private methods

method_private(MyClass::class);

Convert Date

Convert date format

convert_date_format('01-01-2024', 'd-m-Y', 'Y-m-d', $default = null);

Parse date to format.

parse_date_format('01-01-2024', 'Y-m-d', $default = null);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.