jinomial / fw-app-skeleton
The FW application skeleton.
Requires
- php: >=8.3.0
- jinomial/fw-framework: ^1.0
- predis/predis: ^3.4
- psr/simple-cache: ^3.0
- symfony/yaml: ^7.4
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- firebase/php-jwt: ^6.10
- jinomial/fw-cli: ^1.0
- pestphp/pest: ^3.0
- phpstan/phpstan: ^1.11
- swoole/ide-helper: dev-master
This package is auto-updated.
Last update: 2026-03-07 23:26:16 UTC
README
Welcome to your new FW Framework application! FW is a modern, fast, async-first PHP framework built for performance and modularity.
This skeleton provides a robust starting point for building scalable APIs and web applications.
๐ Getting Started
Follow these steps to get your local environment up and running:
1. Configure the Environment
Copy the example environment file. This file contains the configuration for your database, cache, and application secrets.
cp .env.example .env
(Remember: the .env file is loaded exactly once when the Swoole server boots. If you change a value, you must restart the server.)
2. Compile the Application
FW is a compiled framework. Before the application can serve requests, you must compile your declarative routing matrix, database schemas, views, and strict Dependency Injection (DI) container.
We provide the fw CLI tool (installed via Composer) to handle this. You can compile everything at once using the handy developer script:
# Formats code, runs static analysis, compiles everything, and restarts the local server
./bin/dev.sh
Or you can run individual compilation commands via the CLI:
php vendor/bin/fw build:api php vendor/bin/fw build:db php vendor/bin/fw build:view php vendor/bin/fw build:container
3. Start the Async Worker
FW relies on a persistent memory execution model (Swoole) rather than the traditional PHP request lifecycle. Start the application stack using Docker:
docker compose up -d
Your application will now be live at http://localhost:8000!
๐๏ธ Directory Structure Overview
FW enforces a Domain-Driven Design modular structure instead of traditional monolithic app/Controllers and app/Models directories.
modules/: The heart of your application. Group your logic by feature or domain (e.g.,User,Auth,Post). Each module contains its own routing, models, and logic.api/: Declarative YAML definitions mapping endpoints to your module logic.database/: Containsschema.yamlwhich defines your database structure, along with raw SQL migrations.build/: The compiled, blazing-fast static PHP files generated by thefwCLI. Do not edit these manually.config/: Contains framework configuration anddependencies.phpfor binding custom factories into the DI container.public/: The public-facing entry point, containingserver.phpwhich bootstraps the persistent Swoole worker.
๐งช Testing and Tooling
Your application comes pre-configured with industry-standard tooling:
- Testing: We use Pest PHP. Run your test suite with:
vendor/bin/pest
- Static Analysis: PHPStan is configured to catch errors before runtime:
vendor/bin/phpstan analyse
Happy building! ๐