Added Runtime extensions checker
This commit is contained in:
parent
7429420781
commit
50d522dac6
2 changed files with 40 additions and 0 deletions
|
@ -12,6 +12,41 @@
|
|||
*/
|
||||
class Validate
|
||||
{
|
||||
/**
|
||||
* Determines if the runtime meets the required extensions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function requiredExtensions(): array
|
||||
{
|
||||
$requirements = [
|
||||
'zlib',
|
||||
'libxml',
|
||||
'ctype',
|
||||
'json',
|
||||
'mbstring',
|
||||
'posix',
|
||||
'ctype',
|
||||
'tokenizer'
|
||||
];
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach($requirements as $ext)
|
||||
{
|
||||
if(in_array(strtolower($ext), get_loaded_extensions()))
|
||||
{
|
||||
$results[$ext] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$results[$ext] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the version number
|
||||
*
|
||||
|
|
5
tests/utils/runtime_extensions.php
Normal file
5
tests/utils/runtime_extensions.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
var_dump(\ncc\Utilities\Validate::requiredExtensions());
|
Loading…
Add table
Reference in a new issue