yasser-elgammal / green
Green Framework Skeleton
v1.2.0
2026-04-11 12:35 UTC
Requires
- php: ^8.2
- yasser-elgammal/green-core: ^1.2
Requires (Dev)
- phpunit/phpunit: ^12.5
README
Green is a lightweight, modern PHP framework built with PHP 8.2+ features, focusing on simplicity, speed, and developer experience. It leverages PHP Attributes for routing and follows a Table Gateway architecture.
⚡ Quick Start
1. Installation
composer create-project yasser-elgammal/green app-name
cd app-name
cp .env.example .env
php green serve
2. Define a Route
class PostController { #[Route('GET', '/posts/{id}')] public function show(int $id) { return view('posts/show', ['id' => $id]); } }
3. Database Access
$posts = new PostTable(); $post = $posts->fetchById(1);
📖 Master Documentation
The framework is divided into several powerful subsystems. Please refer to the Master Documentation for detailed guides on:
- Core Architecture: Lifecycle and DI patterns.
- Routing & Middleware: Attribute-based routing and pipelines.
- Database & Relations: Eager loading and Table Gateways.
- API Layer: Smart Transformers and Pagination.
- Logic & Validation: Payload-based validation.
- Security & Sessions: State management and hashing.
- Global Exception Handling: Debug Mode and API errors.
- Helper Reference: Glossary of global functions.
- Console Commands: CLI tools and generators.
- Migrations & Schema Builder: Migration workflow, schema operations, dry-run mode, and safe mode.
🛠 Features at a Glance
- ✅ PHP 8.2+ Attributes: No more clunky routing files.
- ✅ Table Gateway: Clean separation of state (Model) and logic (Table).
- ✅ Eager Loading: Simple
include('relation')to solve N+1. - ✅ Smart Transformers: Nested API responses made easy.
- ✅ Auto-Validation: Type-hint payloads for instant validation.
- ✅ Twig Templates: Native Twig integration for clean views.
- ✅ Debug UI: Premium dark-mode error pages.
📜 License
Green Framework is open-sourced under the MIT License.