mingalevme/opcache-status-info

PHP OPcache status information object

1.0.1 2021-07-12 12:09 UTC

This package is auto-updated.

Last update: 2024-10-29 06:06:18 UTC


README

The PHP opcache_get_status-function result wrapper.

codecov quality

Installation

composer require mingalevme/opcache-status-info

Usage

# 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();
}