1. Go to this page and download the library: Download upscale/swoole-warmup 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/ */
upscale / swoole-warmup example snippets
use Upscale\Swoole\Warmup;
\Server('127.0.0.1', 8080);
$server->set([
'dispatch_mode' => 1,
'user' => '_www',
]);
$state = 'cold';
$server->on('request', function ($request, $response) use ($server, &$state) {
$response->header('Content-Type', 'text/plain');
$response->end("Served by $state worker $server->worker_id\n");
$state = 'warm';
});
$crawler = new Warmup\Crawler($server, new Warmup\RequestFactory($server));
$crawler->browse([
'http://127.0.0.1:8080/',
]);
unset($crawler);
$server->start();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.