Added Runtime extensions checker

This commit is contained in:
Zi Xing 2022-04-17 18:47:45 -04:00
parent 7429420781
commit 50d522dac6
2 changed files with 40 additions and 0 deletions

View file

@ -12,6 +12,41 @@
*/ */
class Validate 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 * Validates the version number
* *

View file

@ -0,0 +1,5 @@
<?php
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
var_dump(\ncc\Utilities\Validate::requiredExtensions());