PHP Classes

File: usage/usage.php

Recommend this page to a friend!
  Classes of Miraz Mac   Check PHP Requirements   usage/usage.php   Download  
File: usage/usage.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Check PHP Requirements
Verify conditions for a PHP application to run
Author: By
Last change:
Date: 3 years ago
Size: 1,162 bytes


Class file image Download

require '../vendor/autoload.php';


$checker = new Checker;

// Define requirements

// Make sure the PHP version is equal to or greater than 5.6
// Pass preferred php.ini values as an array
// Note the usage of boolean instead of On/1/Off/0

// Ensures allow_url_fopen is On

requirePhpExtensions(['ffmpeg', 'mbstring'])
requireFile('../composer.json', Checker::CHECK_FILE_EXISTS)
requireDirectory('../src', Checker::CHECK_IS_READABLE)
'allow_url_fopen' => true,
'short_open_tag' => true,
'memory_limit' => '>=64M',

// Runs the check and returns parsed requirements as an array
// Contains parsed requirements with state of the current values and their comparison result
$output = $checker->check();

// Should be called after running check() to see if requirements has met or not
$satisfied = $checker->isSatisfied();

if (
$satisfied) {
"Requirements are met.";
} else {
join(', ', $checker->getErrors());