dev-master
9999999-devnonetallt/joptimize wrapper for laravel
MIT
The Requires
by Jyri Mikkola
laravel php methods optimize
Wallogit.com
2017 © Pedro Peláez
nonetallt/joptimize wrapper for laravel
Joptimize wrapper for Laravel framework, (*1)
, (*2)
composer require nonetallt/joptimize-laravel --dev
Running the command:, (*3)
php artisan joptimize
Publishing the configuration:, (*4)
php artisan vendor:publish --provider="Nonetallt\Joptimize\Laravel\JoptimizeServiceProvider"
Check the main package for supported parameter types and other details, (*5)
<?php
return [
/* Path to the dotenv file you want to save and read the variables from */
'env_path' => base_path('.env'),
/* Create optimization values in .env if the setting is missing */
'create_missing_variables' => false,
/* Declare methods to optimize */
'optimize' => [
[
/* Values you need to calculate only once but are useful for
* multiple iterations, for example: starting time.
*/
'init' => ['example' => true],
/* The method to optimize */
'method' => function($params, $iteration, $initializationValues) {
$sleepTime = $params->SLEEP;
/* Example usage */
if($initializationValues->example) $sleepTime++;
sleep($sleepTime);
},
/* Supported types enum, linear, range
*
* --args for types--
*
* enum : as many args as you want to test as parameter value
* linear : 1. start, 2. end, 3. stepSize (optional, 1 by default)
* range : 1. min , 2. max, 3. maxIterations
*/
'parameters' => [
[
'type' => 'enum',
'name' => 'SLEEP',
'args' => [1],
/* You can use the mutate callback to modify the value
* that will be saved in .env, this can be useful for example
* if you need the value to be an integer instead of float
* when using a range parameter.
*/
'mutate' => function($value) {
return floor($value);
}
]
]
]
]
];
nonetallt/joptimize wrapper for laravel
MIT
laravel php methods optimize