@@ -28,7 +28,7 @@ Laravel-specific and pure PHP helper functions.
28
28
composer require " illuminated/helper-functions:5.6.*"
29
29
```
30
30
31
- 2. That ' s it! Now you can use any of provided helper functions.
31
+ 2. Use any of the provided helper functions.
32
32
33
33
# # Available functions
34
34
@@ -86,7 +86,7 @@ Laravel-specific and pure PHP helper functions.
86
86
87
87
# ### `array_except_value()`
88
88
89
- Removes the given values from array:
89
+ Remove the given values from the array:
90
90
91
91
` ` ` php
92
92
$array = [' foo' , ' bar' , ' baz' ];
@@ -104,7 +104,7 @@ $array = array_except_value($array, ['bar', 'baz']);
104
104
105
105
# ### `multiarray_set()`
106
106
107
- Sets a value for each item of multidimensional array using "dot" notation:
107
+ Set a value for each item of the multidimensional array using " dot" notation:
108
108
109
109
` ` ` php
110
110
$array = [
@@ -124,7 +124,7 @@ multiarray_set($array, 'details.country', 'Germany');
124
124
125
125
# ### `multiarray_sort_by()`
126
126
127
- Sorts multidimensional array by multiple fields:
127
+ Sort the multidimensional array by few fields:
128
128
129
129
` ` ` php
130
130
$array = [
@@ -143,7 +143,7 @@ $sorted = multiarray_sort_by($array, 'name', 'model');
143
143
// ]
144
144
` ` `
145
145
146
- Optionally, you can set required sort order:
146
+ You can set required sort order:
147
147
148
148
` ` ` php
149
149
$array = [
@@ -166,15 +166,15 @@ $sorted = multiarray_sort_by($array, 'name', SORT_ASC, 'model', SORT_DESC);
166
166
167
167
# ### `call_in_background()`
168
168
169
- Calls artisan console command in background. Code execution continues immediately, without waiting for results.
169
+ Call artisan console command in the background. Code execution continues immediately, without waiting for results.
170
170
171
171
` ` ` php
172
172
call_in_background(' report' );
173
173
174
174
// " php artisan report" would be called in background
175
175
` ` `
176
176
177
- Optional `before` and `after` sub-commands can be set as a second and third parameters :
177
+ Optional ` before` and ` after` sub-commands can be set as a second and third parameter :
178
178
179
179
` ` ` php
180
180
call_in_background(' report:monthly subscriptions' , ' sleep 0.3' );
@@ -186,7 +186,7 @@ call_in_background('report:monthly subscriptions', 'sleep 0.3');
186
186
187
187
# ### `db_is_sqlite()`
188
188
189
- Checks if default database connection driver is `sqlite` or not:
189
+ Check if the default database connection driver is ` sqlite` or not:
190
190
191
191
` ` ` php
192
192
if (db_is_sqlite()) {
@@ -196,7 +196,7 @@ if (db_is_sqlite()) {
196
196
197
197
# ### `db_is_mysql()`
198
198
199
- Checks if default database connection driver is `mysql` or not:
199
+ Check if the default database connection driver is ` mysql` or not:
200
200
201
201
` ` ` php
202
202
if (db_is_mysql()) {
@@ -206,7 +206,7 @@ if (db_is_mysql()) {
206
206
207
207
# ### `db_mysql_now()`
208
208
209
- Returns database datetime, using `mysql` connection:
209
+ Get database datetime, using ` mysql` connection:
210
210
211
211
` ` ` php
212
212
$now = db_mysql_now ();
@@ -216,7 +216,7 @@ $now = db_mysql_now();
216
216
217
217
# ### `db_mysql_variable()`
218
218
219
- Returns value of specified `mysql` variable, or `false` if variable doesn' t exist:
219
+ Get the value of specified ` mysql` variable, or ` false` if the variable doesn' t exist:
220
220
221
221
```php
222
222
$hostname = db_mysql_variable(' hostname' );
@@ -228,7 +228,7 @@ $hostname = db_mysql_variable('hostname');
228
228
229
229
#### `to_default_timezone()`
230
230
231
- Converts passed datetime string to default timezone, which is ` app.timezone` config setting:
231
+ Convert passed datetime string to the default timezone, which is `app.timezone` config setting:
232
232
233
233
```php
234
234
$date = to_default_timezone(' 2017-02-28T14:05:01Z' );
@@ -240,7 +240,7 @@ $date = to_default_timezone('2017-02-28T14:05:01Z');
240
240
241
241
#### `backtrace_as_string()`
242
242
243
- Returns backtrace without arguments as string:
243
+ Get backtrace without arguments, as a string:
244
244
245
245
```php
246
246
$backtrace = backtrace_as_string();
@@ -252,7 +252,7 @@ $backtrace = backtrace_as_string();
252
252
253
253
#### `minimized_backtrace_as_string()`
254
254
255
- Returns minimized backtrace as string:
255
+ Get minimized backtrace as a string:
256
256
257
257
```php
258
258
$backtrace = minimized_backtrace_as_string();
@@ -266,7 +266,7 @@ $backtrace = minimized_backtrace_as_string();
266
266
267
267
#### `is_email()`
268
268
269
- Checks if specified string is valid email address or not:
269
+ Check if the specified string is a valid email address or not:
270
270
271
271
```php
272
272
$isEmail = is_email(' john.doe@example.com' );
@@ -276,7 +276,7 @@ $isEmail = is_email('john.doe@example.com');
276
276
277
277
#### `to_rfc2822_email()`
278
278
279
- Converts addresses data to [RFC 2822](http://www.faqs.org/rfcs/rfc2822.html) string, suitable for PHP [mail()](http://ua2.php.net/manual/en/function.mail.php) function:
279
+ Convert addresses data to [RFC 2822](http://www.faqs.org/rfcs/rfc2822.html) string, suitable for PHP [mail()](http://ua2.php.net/manual/en/function.mail.php) function:
280
280
281
281
```php
282
282
$address = to_rfc2822_email([
@@ -297,7 +297,7 @@ $address = to_rfc2822_email(['address' => 'john.doe@example.com', 'name' => 'Joh
297
297
298
298
#### `to_swiftmailer_emails()`
299
299
300
- Converts addresses data to format, which is suitable for [SwiftMailer library](http://swiftmailer.org/docs/messages.html):
300
+ Convert addresses data to format, which is suitable for [SwiftMailer library](http://swiftmailer.org/docs/messages.html):
301
301
302
302
```php
303
303
$addresses = to_swiftmailer_emails([
@@ -320,15 +320,15 @@ $address = to_swiftmailer_emails(['address' => 'john.doe@example.com', 'name' =>
320
320
321
321
#### `relative_path()`
322
322
323
- Returns the relative path of a directory given another one :
323
+ Get the relative path for two directories :
324
324
325
325
```php
326
326
$path = relative_path(' /var/www/htdocs' , ' /var/www/htdocs/example' )
327
327
328
328
// ' ../'
329
329
```
330
330
331
- You can pass relative paths as a parameters :
331
+ You can pass relative path as a parameter too :
332
332
333
333
```php
334
334
$path = relative_path(' /var/www/htdocs/example/public/../../' , ' /var/' )
@@ -340,7 +340,7 @@ $path = relative_path('/var/www/htdocs/example/public/../../', '/var/')
340
340
341
341
#### `get_dump()`
342
342
343
- Returns nicely formatted string representation of the variable, using [Symfony VarDumper Component](http://symfony.com/doc/current/components/var_dumper/introduction.html) with all of it ' s benefits :
343
+ Get nicely formatted string representation of the variable, using [Symfony VarDumper Component](http://symfony.com/doc/current/components/var_dumper/introduction.html):
344
344
345
345
```php
346
346
$array = [
@@ -363,7 +363,7 @@ $dump = get_dump($array);
363
363
364
364
#### `format_bytes()`
365
365
366
- Formats bytes into kilobytes, megabytes, gigabytes or terabytes, with specified precision:
366
+ Format bytes into kilobytes, megabytes, gigabytes or terabytes, with specified precision:
367
367
368
368
```php
369
369
$formatted = format_bytes(3333333);
@@ -373,7 +373,7 @@ $formatted = format_bytes(3333333);
373
373
374
374
#### `format_xml()`
375
375
376
- Formats xml string using new lines and indents:
376
+ Format XML string using new lines and indents:
377
377
378
378
```php
379
379
$formatted = format_xml(' < ? xml version=" 1.0" ? ><root><task priority=" low" ><to> John< /to><from> Jane< /from><title> Go to the shop< /title></task><task priority=" medium" ><to> John< /to><from> Paul< /from><title> Finish the report< /title></task><task priority=" high" ><to> Jane< /to><from> Jeff< /from><title> Clean the house< /title></task></root> ' );
@@ -402,15 +402,15 @@ $formatted = format_xml('<?xml version="1.0"?><root><task priority="low"><to>Joh
402
402
403
403
#### `is_json()`
404
404
405
- Checks if specified variable is valid json -encoded string or not:
405
+ Check if specified variable is a valid JSON -encoded string or not:
406
406
407
407
```php
408
408
$isJson = is_json(' {" foo" :1," bar" :2," baz" :3}' );
409
409
410
410
// true
411
411
```
412
412
413
- Function can return decoded json, if you pass the second `return` argument as `true`:
413
+ It can return decoded JSON if you pass the second argument as `true`:
414
414
415
415
```php
416
416
$decoded = is_json(' {" foo" :1," bar" :2," baz" :3}' , true);
@@ -422,7 +422,7 @@ $decoded = is_json('{"foo":1,"bar":2,"baz":3}', true);
422
422
423
423
#### `str_lower()`
424
424
425
- Converts string to lowercase, using `mb_strtolower` in `UTF-8` encoding:
425
+ Convert string to lowercase, using `mb_strtolower` in `UTF-8` encoding:
426
426
427
427
```php
428
428
$lower = str_lower(' TeSt' );
@@ -432,7 +432,7 @@ $lower = str_lower('TeSt');
432
432
433
433
#### `str_upper()`
434
434
435
- Converts string to uppercase, using `mb_strtoupper` in `UTF-8` encoding:
435
+ Convert string to uppercase, using `mb_strtoupper` in `UTF-8` encoding:
436
436
437
437
```php
438
438
$upper = str_upper(' TeSt' );
@@ -444,7 +444,7 @@ $upper = str_upper('TeSt');
444
444
445
445
#### `is_windows_os()`
446
446
447
- Checks if php is running on Windows OS or not:
447
+ Check if PHP is running on Windows OS or not:
448
448
449
449
```php
450
450
$isWindowsOs = is_windows_os();
@@ -456,7 +456,7 @@ $isWindowsOs = is_windows_os();
456
456
457
457
#### `xml_to_array()`
458
458
459
- Converts xml string to array:
459
+ Convert XML string to the array:
460
460
461
461
```php
462
462
$array = xml_to_array(' < ? xml version=" 1.0" ? >
@@ -490,11 +490,11 @@ $array = xml_to_array('<?xml version="1.0"?>
490
490
// ]
491
491
```
492
492
493
- Alternatively, you can pass an instance of `SimpleXMLElement` object, to get the same results.
493
+ Alternatively, you can pass an instance of a `SimpleXMLElement` object, to get the same results.
494
494
495
495
#### `array_to_xml()`
496
496
497
- Converts array to xml string using [spatie/array-to-xml](https://github.com/spatie/array-to-xml) package:
497
+ Convert array to XML string using [spatie/array-to-xml](https://github.com/spatie/array-to-xml) package:
498
498
499
499
```php
500
500
$array = [
0 commit comments