$path,'exists'=>false,'readable'=>false,'type'=>null,'keys'=>[], 'notes'=>[]]; if (is_file($path)) { $out['exists']=true; $out['readable']=is_readable($path); try { $cfg = require $path; $out['type']=gettype($cfg); if (is_array($cfg)) { $out['keys']=array_keys($cfg); } } catch (Throwable $e) { $out['notes'][] = $e->getMessage(); } } else { $out['notes'][]='file not found'; } echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);