GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kanekescom/laravel-helperia: Helper for rapid Laravel development improvements

BranchesTags
Open more actions menu

Latest commit

 

History

131 Commits
131 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
config
config
 
 
database
database
 
 
resources/views
resources/views
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpstan-baseline.neon
phpstan-baseline.neon
 
 
phpstan.neon.dist
phpstan.neon.dist
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

Repository files navigation

Laravel Helperia

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

Laravel helper package for speeding up application development.

Support the Project

If you find this package helpful, consider supporting its development:

GitHub Sponsors Ko-fi Buy Me a Coffee Patreon Saweria

Installation

composer require kanekescom/laravel-helperia

Usage

Helper Functions

Reflection Helpers

Get method names from a class:

// Get all public methods (excluding constructor, destructor, internal)
method_public(MyClass::class); // Collection of method names

// Get all protected methods
method_protected(MyClass::class);

// Get all private methods
method_private(MyClass::class);

// Get all methods (public, protected, private)
method_all(MyClass::class);

// Also works with object instances
$obj = new MyClass();
method_public($obj); // Same result as using class name

Date Helpers

Convert and parse date formats:

// Convert date from one format to another
convert_date_format('01-01-2024', 'd-m-Y', 'Y-m-d'); // "2024-01-01"
convert_date_format('01-01-2024 10:30:00', 'd-m-Y H:i:s', 'Y-m-d H:i:s');

// Parse date string to specified format
parse_date_format('2024-01-01', 'd M Y'); // "01 Jan 2024"
parse_date_format('2024-01-01 10:30:00', 'd M Y H:i:s');

// With default value for invalid/null input
convert_date_format(null, 'd-m-Y', 'Y-m-d', 'N/A'); // "N/A"
convert_date_format('invalid-date', 'd-m-Y', 'Y-m-d', 'fallback'); // "fallback"
parse_date_format('not-a-date', 'Y-m-d', 'default'); // "default"

Support Classes

ClassExtender

A base class for wrapping other classes and forwarding method calls:

use Kanekescom\Helperia\Support\ClassExtender;

class MyWrapper extends ClassExtender
{
    public function __construct()
    {
        $this->class = new SomeOtherClass();
    }
}

$wrapper = new MyWrapper();
$wrapper->someMethod(); // Calls SomeOtherClass::someMethod()

HasMethodCaller Trait

Trait for forwarding method calls to a wrapped class instance:

use Kanekescom\Helperia\Traits\HasMethodCaller;

class MyClass
{
    use HasMethodCaller;

    protected $class;

    public function __construct($wrappedClass)
    {
        $this->class = $wrappedClass;
    }
}

// Usage
$wrapper = new MyClass(new SomeService());
$wrapper->serviceMethod(); // Forwards to SomeService::serviceMethod()

// Static method calls are also supported
MyClass::staticMethod(); // Forwards static calls

Note: If a method doesn't exist on either the wrapper or wrapped class, a BadMethodCallException will be thrown.


Testing

composer test

Changelog

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

Security Vulnerabilities

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

Credits

  • Achmad Hadi Kurnia
  • All Contributors

License

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

About

Helper for rapid Laravel development improvements

Topics

helperhelperiakanekescomlaravellaravel-helperiaphp

Resources

Readme
MIT license
Activity
Custom properties

Stars

0 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.