Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
OpenSwoole Core is core library implemented with PHP working together with OpenSwoole runtime. You can install OpenSwoole core with composer require openswoole/core
.
The features provided by OpenSwoole core:
MySQLi
, PDO
, Redis
etcWaitGroup
MySQLi
, PDO
, Redis
etc clients<?php
declare(strict_types=1);
use OpenSwoole\Core\Coroutine\Pool\ClientPool;
use OpenSwoole\Core\Coroutine\Client\PDOClientFactory;
use OpenSwoole\Core\Coroutine\Client\PDOConfig;
co::run(function() {
$pool = new ClientPool(PDOClientFactory::class, new PDOConfig(), 8, true);
$mysqlClient = $pool->get();
$mysqlClient->query('SELECT SLEEP(10)')->fetch();
$pool->put($mysqlClient);
});