easoblue / larahelper
Laravel helpers.
Requires
- php: ^7.2|^8.0
- illuminate/support: ^5.8|^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
README
Installation
You can install the package via composer:
composer require easoblue/larahelper
Usage
You can add alias for shorthand or import LaraHelper facade directly.
use Easoblue\LaraHelper\Facade\LaraHelper;
Once ready you can use generateString method to generate random or unique string. You can pass paramter to generate specific type of string.
LaraHelper::generateString('alpha');
You can use checkUnique and chain with generateString, table name and column name will be required to validate the unique string.
LaraHelper::checkUnique('users','username')->generateString('alpha');
LaraHelper::checkUnique('users','username')->generateString('alpha'); LaraHelper::checkUnique('users','username')->prefix('u_')->postfix('u_')->generateString('alpha'); // prefix will be prepended to the generated string before checking unique. Same as postfix will be appended to the generated string before checking unique. // This method will format the error response and return the object with single validation error instead of array. // $validator is the intance of Illuminate\Validation\Validator class; if($validator->fails()){ return LaraHelper::formatValidatorError($validator); } LaraHelper::formatToCamelCase('format to camel case');
Testing
to be added.
Complete documentation
Complete documentation will be available at doc.easoblue.com
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email issues@easoblue.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.