bagsiz / easy-functions
Laravel package for useful & easy PHP functions
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/bagsiz/easy-functions
Requires
- php: ^7.2
- illuminate/database: ~5.8.0
- laravel/framework: ^5.4.0
Requires (Dev)
- orchestra/testbench: ~3.8.0
- phpunit/phpunit: ^7.5|^8.0
This package is auto-updated.
Last update: 2025-10-29 02:50:19 UTC
README
Laravel package for useful & easy functions
Installation
This package can be installed through Composer.
composer require bagsiz/easy-functions
Functions
checkFieldForRandom
This function aims to check a model's fields against a random value and return that value
Usage
For example we want to check the id fields of App\User model,
you should write;
function checkUserModel() { $user = new User(); $return EasyFunction::checkFieldForRandom($user, 'id', 'int', 8); }
checkFieldForRandom($model, string $field, string $type, int $length)
- $model = The collection of the model
- $fiels = The field of the model -> String
'field' - $type = The type of value you want to generate -> String
'str'or Integer'int'. Default'str' - $length = The length of value you want to generate -> Int
8. Default8
decimalToTime
This function aims to convert an integer with a decimal to time string
Usage
function someFunction() { $timeString = EasyFunction::decimalToTime(936437.85); // Should return "10:20:07:17.85" }
decimalToTime(int $decimal)
- $decimal = Must have a "." for decimal part. (Ex: 23.56)
Testing
./vendor/bin/phpunit