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-11-29 06:22:56 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();
}