Why EasySwoole 3.x Is the High‑Performance PHP Framework for API Services
EasySwoole 3.x is a resident‑memory, coroutine‑based PHP framework built on Swoole that supports HTTP, WebSocket, TCP/UDP, offers numerous ready‑made components, and provides simple installation and startup steps for building high‑performance API services.
Overview
EasySwoole 3.x is a resident‑memory distributed PHP framework built on Swoole Server, designed for API services. It heavily encapsulates Swoole coroutine features and supports mixed HTTP, WebSocket, custom TCP/UDP listeners, offering many ready‑made components.
Features
Core positioning : high‑performance coroutine framework, event‑driven, asynchronous tasks, millisecond timers; API‑first but also suitable for WebSocket, TCP/UDP real‑time communication.
Key advantages :
Supports millions of concurrent connections.
Resident memory; files loaded once for ultra‑fast response.
Production‑grade validation, adopted by Tencent IEG, Wangsu, 360 Finance, Meitu, etc.
Supported protocols : HTTP, WebSocket, custom TCP/UDP, UnixSocket.
Runtime modes : async/sync/coroutine, multi‑process/multi‑thread, CPU affinity, daemon, SSL/TLS encryption.
Components
The framework ships with a rich set of coroutine components ready out‑of‑the‑box:
Database/Cache : coroutine MySQL/Redis/Memcached pools, ORM similar to ThinkPHP.
Message/Search : coroutine Kafka, NSQ, ElasticSearch clients.
Network/Client : coroutine HTTP/SMTP clients.
Config/Permission : distributed RPC, Consul/Apollo config centers, JWT/OAuth/Casbin authentication.
Tools : Snowflake ID generator, second‑level Crontab, custom processes, message queues, tracing, rate limiter, Fast‑Cache.
Others : coroutine template engine, EventLoop API, object pool, micro‑service support.
Installation & Startup
Environment requirements : PHP 7.2+ and Swoole 4.4+ extension.
Composer installation : composer require easyswoole/easyswoole=3.* Initialize project :
php vendor/easyswoole/easyswoole/bin/easyswoole.php installStart service :
# Start framework
cd /var/www
php easyswoole.php server startDefaults to listening on port 9501 (HTTP) and works with Nginx reverse proxy.
Configuration file : located under EasySwoole/Conf for server and listener settings.
Basic Usage
HTTP service : create controllers extending App\HttpController. Example:
class IndexController extends EasySwoole\Http\AbstractInterface\Controller
{
public function index()
{
$this->response()->write('Hello EasySwoole');
}
}WebSocket/TCP : configure listeners and implement WebSocketInterface or custom handlers.
Extension development : custom processes, scheduled tasks, middleware, exception handling.
Development mode : hot reload, logging, debugging tools.
Official site: https://www.easyswoole.com
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
