explaingit

swoft-cloud/swoft

5,544PHPAudience · developerComplexity · 4/5Setup · hard

TLDR

A high-performance PHP framework powered by Swoole that keeps your app running persistently in memory, making it much faster than traditional PHP at handling many simultaneous requests.

Mindmap

mindmap
  root((repo))
    What it does
      PHP framework
      In-memory server
      High performance
    Server Types
      HTTP server
      WebSocket server
      RPC and TCP servers
    Features
      Connection pools
      Annotation routing
      Circuit breakers
    Use Cases
      High traffic API
      Real-time chat
      PHP microservices
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a high-traffic REST API that handles thousands of concurrent requests without the overhead of starting a new PHP process per request.

USE CASE 2

Set up a WebSocket server for a real-time chat or notification feature using PHP and Swoole.

USE CASE 3

Replace a slow traditional PHP app with Swoft's connection-pooled architecture to reduce database latency at scale.

Tech stack

PHPSwooleComposer

Getting it running

Difficulty · hard Time to first run · 1h+

Requires PHP 7.1+ and the Swoole extension, not compatible with standard shared PHP-FPM hosting environments.

License not specified in the explanation.

In plain English

Swoft is a PHP framework for building fast web services and APIs. Traditional PHP applications start fresh with every incoming request, which adds overhead. Swoft takes a different approach: it runs persistently in memory using a PHP extension called Swoole, so the application starts once and stays running. This makes it faster at handling large numbers of requests simultaneously. The framework supports multiple types of servers you can run from the command line: an HTTP server for web requests, a WebSocket server for real-time connections, an RPC server for communication between internal services, and a TCP server for lower-level network communication. You start whichever type of server your application needs with a single command. Swoft borrows organizational patterns from enterprise Java frameworks like Spring Cloud, adapted for PHP. It uses annotations in your code to configure routing, dependency injection, and cross-cutting behavior like logging or access control, without requiring large configuration files. It includes connection pools for databases and caches, which means database connections are reused across requests rather than opened and closed each time. The database and cache layers are designed to look and behave similarly to Laravel's equivalents, so developers already familiar with Laravel can work with those parts without relearning. It also includes built-in support for service discovery, circuit breakers (which stop sending requests to a failing service rather than letting errors pile up), rate limiting, and configuration management through external systems like Consul or Apollo. Swoft requires PHP 7.1 or later and the Swoole extension. It installs through Composer, the standard PHP package manager. The documentation site is at swoft.org.

Copy-paste prompts

Prompt 1
I'm setting up a Swoft HTTP server. Write a controller with a REST endpoint that queries MySQL using the built-in connection pool and returns JSON.
Prompt 2
Using Swoft's annotation system, add middleware that logs request duration and blocks any IP address that exceeds 100 requests per minute.
Prompt 3
I have a Laravel app I want to migrate to Swoft. Show me how to convert a Laravel Eloquent model and route definition to the Swoft equivalent.
Prompt 4
Help me configure Swoft's circuit breaker to stop forwarding requests to a failing downstream service and return a cached fallback response instead.
Open on GitHub → Explain another repo

← swoft-cloud on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.