PHP code example of net_bazzline / php_component_apache_server_status_parser

1. Go to this page and download the library: Download net_bazzline/php_component_apache_server_status_parser 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/ */

    

net_bazzline / php_component_apache_server_status_parser example snippets


//If you want to parse the whole apache server status
//  and create domain objects out of the information.

//begin of dependencies
$parserBuilderFactory       = new \Net\Bazzline\Component\ApacheServerStatusParser\Service\Builder\ParserBuilderFactory();
$storageBuilder             = new \Net\Bazzline\Component\ApacheServerStatusParser\Service\Builder\RemoteStorageBuilder();

$parserBuilder  = $parserBuilderFactory->create();
//end of dependencies

//begin of business logic
//  the following five logical lines are doing the trick
$storageBuilder->setUrlToTheApacheStatusFileToParseUpfront('<the url to your apache server status>');
$storageBuilder->selectParseModeAllUpfront();

$storageBuilder->build();

$parserBuilder->setStorageUpfront(
    $storageBuilder->andGetStorageAfterTheBuild();
);
$parserBuilder->build();

//  and now, do something with the result
var_dump(
    $parserBuilder->andGetListOfDetailOrNullAfterwards()
);
var_dump(
    $parserBuilder->andGetInformationOrNullAfterwards()
);
var_dump(
    $parserBuilder->andGetScoreboardOrNullAfterwards()
);
var_dump(
    $parserBuilder->andGetStatisticOrNullAfterwards()
);
//end of business logic