Added helpers.php

This commit is contained in:
Deon George 2018-06-12 16:07:42 +10:00
parent c5413d5b50
commit 55d369df47
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
2 changed files with 19 additions and 1 deletions

View File

@ -18,7 +18,10 @@
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Leenooks\\": "src" "Leenooks\\": "src"
} },
"files": [
"src/helpers.php"
]
}, },
"extra": { "extra": {
"laravel": { "laravel": {

15
src/helpers.php Normal file
View File

@ -0,0 +1,15 @@
<?php
// is_json helper
if (! function_exists('is_json')) {
function is_json($string) {
try {
json_decode($string);
} catch (\Exception $e) {
return FALSE;
}
return (json_last_error() == JSON_ERROR_NONE);
}
}