1. Go to this page and download the library: Download bitsensor/php 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/ */
bitsensor / php example snippets
use BitSensor\Core\BitSensor;
use BitSensor\Core\Config;
use BitSensor\Connector\ApiConnector;
use BitSensor\Blocking\Blocking;
use BitSensor\Blocking\Action\BlockingpageAction;
use BitSensor\Handler\IpHandler;
use BitSensor\Handler\AfterRequestHandler;
// Load Composer's autoloader
sor.io
Blocking::setAction(new BlockingpageAction());
BitSensor::setConnector(new ApiConnector());
IpHandler::setIpAddressSrc(IpHandler::IP_ADDRESS_REMOTE_ADDR);
AfterRequestHandler::setExecuteFastcgiFinishRequest(true); // If you are using FastCGI
BitSensor::setEnableUopzHook(true); // If you have enabled UOPZ
// Start BitSensor
BitSensor::run();
use BitSensor\Core\BitSensor;
BitSensor::configure('/path/to/config.json');
use Monolog\Logger;
use Monolog\Handler\PsrHandler;
use BitSensor\Handler\PsrLogHandler;
// Your existing logger code
$log = new Logger('name');
// Add the BitSensor PsrLogHandler
$log->pushHandler(new PsrHandler(new PsrLogHandler()));
use \BitSensor\Core\BitSensor;
BitSensor::putEndpoint("tag", "cool-applications");
use \BitSensor\Core\BitSensor;
use \BitSensor\Core\EndpointConstants;
BitSensor::putEndpoint(EndpointConstants::WEBSOCKET, 'true');
bash
# You might have to install `pecl` and php-dev dependencies
sudo apt-get install php-pear php-dev
pecl install uopz
# You might have to add `extension=uopz.so` to your php.ini, if that does not happen automatically
echo 'extension=uopz.so' >> /etc/php/7.0/fpm/php.ini
# In case of php-fpm, reload the service
service php7.0-fpm reload
# Check successful installation, the output should be `1`
php -r 'echo extension_loaded("uopz");'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.