PHP code example of outcompute / phpwatchdog
1. Go to this page and download the library: Download outcompute/phpwatchdog 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/ */
outcompute / phpwatchdog example snippets
\OutCompute\PHPWatchDog\Main::configure(
array(
'functions' => array(
'json_encode()' => array(
'default' => 'block',
'except' => array(
array(
'scope' => 'CustomJSONEncoder->encode()'
)
)
)
)
)
);
\OutCompute\PHPWatchDog\Main::configure(
array(
'files' => array(
'licenceKeys' => array(
'default' => 'block',
'except' => array(
array(
'scope' => 'Licence->get()'
)
)
)
)
)
);
/*
* @var array $watchlist An array of the following format.
* array(
* 'functions' => array(
* 'targetFunction()' => array(
* 'default' => 'block', # Mandatory Key, can be either 'allow' or 'block'
* # If default is block, the below combinations in 'except' will allow targetFunction().
* # If default is allow, then the below combinations will block targetFunction().
* 'except' => array(
* array(
* 'file' => 'AllowedFile.php',
* 'scope' => 'AllowedClass->AllowedMethod()'
* ),
* ... # You can specify more combinations here targeting targetFunction()
* )
* )
* ),
* 'files' => array(
* 'logs.log' => array(
* 'default' => 'allow',
* 'except' => array(
* array(
* 'file' => 'upload.php'
* ),
* ...
* )
* )
* )
* )
* @var boolean $haltOnIncident Specifies if the library should call die() after throwing the Exception() anytime a policy violation incident happens
*/
\OutCompute\PHPWatchDog\Main::configure($watchlist, $haltOnIncident)