Installation
Getting Fast running takes about a minute. There is no package manager step, no build tool, and nothing to compile. You need PHP and the source, and that is it.
Requirements
Fast runs on PHP 8.5 or newer using the command-line SAPI. It relies on three standard extensions that already ship with the CLI on most systems:
| Extension | Why Fast needs it |
|---|---|
sockets | Accepting connections and talking to subsystems over sockets. |
pcntl | Forking the worker pool and handling signals for graceful shutdown. |
posix | Process and permission checks used by the prefork runtime. |
You can confirm your setup in one command:
php -v
php -m | grep -E 'sockets|pcntl|posix'
If all three show up and your version is 8.5+, you are ready.
Getting the source
Fast is a single self-contained package. Drop it into your project and point a bootstrap file at its autoloader. A typical bootstrap.php looks like this:
require __DIR__ . '/framework/src/entry.php';
That entry file registers Fast's autoloader for the Fast\ namespace and pulls in the global helper functions like get(), serve(), and json(). From here on, every example in these docs assumes your app requires that bootstrap first.
Your first server
Create a file called server.php next to your bootstrap:
require __DIR__ . '/bootstrap.php';
get('/', fn (): string => 'It works!');
serve(host: '127.0.0.1', port: 8080, workers: 2);
Run it:
php server.php
You should see a line telling you the master is listening:
[fast] master 12345 listening on http://127.0.0.1:8080 with 2 worker(s)
Now hit it from another terminal:
curl http://127.0.0.1:8080/
You will get back It works!. When you are done, press Ctrl-C and Fast drains in-flight connections before shutting down cleanly.
Running the examples
Fast ships with runnable examples that show off each subsystem. They live in the framework's examples/ directory and each one is a complete server you can start directly:
php examples/server.php # routing basics
php examples/db_server.php # a SQLite-backed demo
php examples/realtime_server.php # SSE and WebSockets
Poke at those whenever a section of these docs mentions a feature you want to see working end to end.
Next up: how a Fast application actually runs, in Application Lifecycle.