Skip to content

WebFiori/app

WebFiori App Template

WebFiori Logo

Build Status Latest Release Downloads

The default application template for WebFiori Framework. Use this as a starting point to create new WebFiori projects.

Requirements

  • PHP >= 8.1
  • Extensions: json, mbstring, fileinfo, openssl
  • Composer

Quick Start

composer create-project webfiori/app my-site
cd my-site
php -S localhost:8080 -t public

Then open http://localhost:8080 in your browser.

Project Structure

β”œβ”€β”€ public/             # Web server document root
β”‚   β”œβ”€β”€ index.php       # Application entry point
β”‚   β”œβ”€β”€ .htaccess       # Apache rewrite rules
β”‚   β”œβ”€β”€ web.config      # IIS rewrite rules
β”‚   └── assets/         # Static files (CSS, JS, images)
β”œβ”€β”€ App/                # Application source code
β”‚   β”œβ”€β”€ Apis/           # REST API services
β”‚   β”œβ”€β”€ Commands/       # Custom CLI commands
β”‚   β”œβ”€β”€ Config/         # Configuration files (auto-generated)
β”‚   β”œβ”€β”€ Database/       # Migrations, seeders, tables
β”‚   β”œβ”€β”€ Domain/         # Domain entities
β”‚   β”œβ”€β”€ Health/         # Health check implementations
β”‚   β”œβ”€β”€ Ini/            # Initialization and route definitions
β”‚   β”œβ”€β”€ Langs/          # Internationalization files
β”‚   β”œβ”€β”€ Middleware/     # Custom middleware
β”‚   β”œβ”€β”€ Pages/          # Page controllers and views
β”‚   β”œβ”€β”€ Policies/       # ABAC policy classes
β”‚   β”œβ”€β”€ Storage/        # Sessions, logs, uploads (not web-accessible)
β”‚   └── Tasks/          # Background jobs and scheduled tasks
β”œβ”€β”€ tests/              # PHPUnit tests
β”œβ”€β”€ composer.json
β”œβ”€β”€ webfiori            # CLI entry point (Linux/macOS)
└── webfiori.bat        # CLI entry point (Windows)

Customizing the App Directory

By default, the framework uses App/ as the application root directory. To change this, edit the first parameter of App::initiate() in public/index.php:

App::initiate('MyApp', 'public', __DIR__);

Reasons you might want to rename it:

  • Gives your project a distinct identity instead of a generic App/ folder.
  • Avoids naming conflicts if you're integrating WebFiori into an existing project that already has an App/ directory.
  • Makes it easier to distinguish between multiple WebFiori-based projects in the same workspace.

Running Tests

composer test

Code Style

This project uses PHP CS Fixer for code style enforcement.

composer cs-check   # Check for violations (dry run)
composer cs-fix     # Auto-fix violations

CLI Usage

WebFiori includes a CLI tool for common tasks:

# Linux/macOS
php webfiori

# Windows
webfiori.bat

Common commands:

php webfiori create:service       # Create a new API service
php webfiori create:middleware    # Create a new middleware
php webfiori create:migration    # Create a database migration
php webfiori create:command      # Create a custom CLI command
php webfiori migrations:run      # Run pending migrations
php webfiori migrations:step     # Interactively apply/skip migrations
php webfiori routes:cache        # Build route cache for production
php webfiori services:list       # List auto-discovered API services
php webfiori help                # Show all available commands

Documentation

Contributing

For information on how to contribute, see the contribution guide.

Reporting Issues

License

This project is licensed under the MIT License.

About

🌸 PHP web development framewrok. Built to help in creating websites.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors