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.2 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.2+, 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.
Reloading on changes
Fast loads your code once and keeps it in memory, so an edit will not show up until the server restarts. While you are developing, add --watch (or -w) and Fast restarts itself every time you save:
php server.php --watch
Now editing a route or a view is live on the next request, the same quick loop you would get from a classic PHP setup. Fast watches your project's .php files and skips folders like vendor and .git. If a save has a syntax error, Fast prints it and waits for your next save instead of crash-looping.
Reload is a development helper only. Every restart is a fresh process, so anything held in memory (sessions, cache, open WebSocket or SSE connections) resets on each save. Leave the flag off in production.
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.