PHP code example of mingalevme / opcache-status-info

1. Go to this page and download the library: Download mingalevme/opcache-status-info library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mingalevme / opcache-status-info example snippets


# some bootstrap file

use Mingalevme\OpcacheStatusInfo\Fetcher as OpcacheStatusInfoFetcher;
use Mingalevme\OpcacheStatusInfo\Fetcher\OpcacheGetStatusFetcher;

$fetcher = new OpcacheGetStatusFetcher();

$someDIContainer->bind(OpcacheStatusInfoFetcher::class, function() use ($fetcher): OpcacheStatusInfoFetcher {
    return $fetcher;
});

# some app file

use Mingalevme\OpcacheStatusInfo\Fetcher;
use Mingalevme\OpcacheStatusInfo\OpcacheStatusScriptInfo;

/** @var Fetcher $fetcher */
$fetcher = $someDIContainer->get(Fetcher::class);

$opcacheStatusInfo = $fetcher->fetch();

echo $opcacheStatusInfo->isEnabled();

/** @var OpcacheStatusScriptInfo $opcacheStatusScriptInfo */
foreach ($opcacheStatusInfo->getScripts() as $opcacheStatusScriptInfo) {
    echo $opcacheStatusScriptInfo->getFullPath();
}