jinomial/fw-app-skeleton

The FW application skeleton.

Maintainers

Package info

github.com/jinomial/fw-app-skeleton

Type:project

pkg:composer/jinomial/fw-app-skeleton

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.3 2026-03-07 23:24 UTC

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/: Contains schema.yaml which defines your database structure, along with raw SQL migrations.
  • build/: The compiled, blazing-fast static PHP files generated by the fw CLI. Do not edit these manually.
  • config/: Contains framework configuration and dependencies.php for binding custom factories into the DI container.
  • public/: The public-facing entry point, containing server.php which 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! ๐Ÿš€