1. Go to this page and download the library: Download anexia/zf2-monitoring 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/ */
anexia / zf2-monitoring example snippets
// new service class /module/Application/Service/UpCheckService.php
namespace Application\Service;
use Anexia\Monitoring\Service\UpCheckServiceInterface;
class UpCheckService implements UpCheckServiceInterface
{
/**
* {@inheritdoc}
*/
public function check(&$errors = array())
{
// add db check/validation here
/**
* e.g.:
*
* if ($success) {
* return true;
* } else {
* $errors[] = 'Database failure: something went wrong!';
* return false;
* }
*/
}
}
// new service's factory class /module/Application/Service/UpCheckServiceFactory.php
namespace Application\Service;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* Class UpCheckServiceFactory
* @package Application\Service
*/
class UpCheckServiceFactory implements FactoryInterface
{
/**
* (non-PHPdoc)
* @see \Zend\ServiceManager\FactoryInterface::createService()
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$upCheckService = new UpCheckService();
return $upCheckService;
}
}