PHP code example of bear / swoole
1. Go to this page and download the library: Download bear/swoole 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/ */
bear / swoole example snippets
(rod-hal-app', // context
'MyVendor\MyProject', // application name
'127.0.0.1', // IP
8080 // port
));
use Psr\Http\Message\ServerRequestInterface;
class MyResource extends ResourceObject
{
public function __construct(
private ServerRequestInterface $request
) {}
public function onGet(): static
{
$server = $this->request->getServerParams();
$query = $this->request->getQueryParams();
// ...
}
}