PHP code example of anexia / neos-monitoring
1. Go to this page and download the library: Download anexia/neos-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 / neos-monitoring example snippets
namespace Anexia\Neos\Monitoring\Check;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Persistence\Doctrine\Exception\DatabaseConnectionException;
use Neos\Flow\Persistence\PersistenceManagerInterface;
class DatabaseCheck implements CheckInterface
{
/**
* @Flow\Inject
* @var PersistenceManagerInterface
*/
protected $persistenceManager;
/**
* Check if a specific function works correctly.
* Return false for a generic error message, otherwise throw an exception with a custom message
*
* @return bool
* @throws DatabaseConnectionException
*/
public function run(): bool
{
if ($this->persistenceManager->isConnected()) {
return true;
}
throw new DatabaseConnectionException('Could not connect to the database.');
}
}
php ./flow neos.flow:package:rescan
php ./flow package:activate Anexia.Neos.Monitoring