gemvc / framework
Super light Framework based on Gemvc Library
v5.9.18
2025-03-18 23:11 UTC
Requires
- php: >=8.0
- gemvc/library: ^3.11.1
Requires (Dev)
- phpstan/phpstan: ^2.1
- dev-main
- v5.9.18
- v5.9.17
- v5.9.16
- v5.9.15
- v5.9.14
- v5.9.13
- v5.9.12
- v5.9.11
- v5.9.10
- v5.9.9
- v5.9.8
- v5.9.7
- v5.9.6
- v5.9.5
- v5.9.4
- v5.9.3
- v5.9.2
- v5.9.1
- v5.9.0
- v5.8.9
- v5.8.8
- v5.8.7
- v5.8.6
- v5.8.5
- v5.8.4
- v5.8.3
- v5.8.2
- v5.8.1
- v5.8.0
- v5.7.11
- v5.7.10
- v5.7.9
- v5.7.8
- v5.7.7
- v5.7.6
- v5.7.5
- v5.7.4
- v5.7.3
- v5.7.2
- v5.7.1
- v5.7.0
- v5.6.2
- v5.6.1
- v5.6.0
- v5.5.3
- v5.5.2
- v5.5.1
- v5.5.0
- v5.4.7
- v5.4.6
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.1
- v5.1.0
- v5.0.12
- v5.0.11
- v5.0.10
- v5.0.9
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.1.0
- v4.0.0
- v3.8.5
- v3.8.4
- v3.8.3
- v3.8.2
- v3.8.1
- v3.8.0
- v3.7.0
- v3.6.1
- v3.6.0
- v3.5.1
- v3.5.0
- v3.4.0
- v3.2.1
- v3.2.0
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v2.11.0
- v2.10.0
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8.0
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.0
- v2.4.12
- v2.4.11
- v2.4.10
- v2.4.9
- v2.4.8
- v2.4.7
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.8
- v2.3.7
- v2.3.6
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- 1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.1
- v1.3.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-error
This package is auto-updated.
Last update: 2025-05-18 23:33:03 UTC
README
Built on top of the powerful GEMVC Library, the GEMVC Framework provides a complete solution for building secure, type-safe PHP applications.
📚 Table of Contents
- AI-Ready Architecture
- Framework Architecture
- Key Features
- GEMVC Core
- Quick Start
- Core Features
- Documentation
🤖 AI-Ready Architecture
AI Integration Files
- Framework:
GEMVCFrameworkAIAssist.jsonc
: Framework-specific AI assistanceGEMVCFrameworkAPIReference.json
: Framework API documentationFrameworkREADME.md
: This file
AI Tool Support
- Cursor: Full context-aware code completion
- GitHub Copilot: Intelligent code suggestions
- Other AI Tools: Compatible with modern AI assistants
🏗️ Framework Architecture
// Clean layered architecture Frontend Request → Service (Authentication & Validation) → Controller (Business Logic) → Model (Data Logic & Response) → Table (Database Operations)
🎯 Key Features
Type-Safe Development
class ClassroomModel extends ClassroomTable { /** @var array<PlannedTeacherModel> */ public array $_classroom_teachers; public function getWithTeachers(): self { $classroom = $this->findOrFail($this->id); $classroom->_classroom_teachers = (new PlannedTeacherModel()) ->byClassroom($classroom->id); return $classroom; } }
Smart Model Properties
class UserModel extends UserTable { // Database columns public int $id; public string $name; // Non-database properties (note the underscore) /** @var array<RoleModel> */ public array $_roles; }
Clean Service Layer
class UserService extends AuthService { public function create(): JsonResponse { $this->auth->authorize(['admin']); $this->validatePosts(['name' => 'string']); return (new UserController($this->request))->create(); } }
🚀 GEMVC
Transform your PHP development with GEMVC - where security meets simplicity! Build professional, secure APIs in minutes, not hours.
// From complex, error-prone code... $stmt = $pdo->prepare("SELECT u.id, u.name FROM users WHERE status = ?"); $stmt->execute(['active']); // To elegant, secure simplicity! 😍 $users = QueryBuilder::select('u.id', 'u.name') ->from('users') ->whereEqual('status', 'active') ->run($pdoQuery);
🌟 Why GEMVC Stands Out
🛡️ Bank-Grade Security, Zero Effort
// Automatic protection against: // ✓ SQL Injection // ✓ XSS Attacks // ✓ Path Traversal // ✓ Shell Injection // ✓ File Upload Vulnerabilities // Military-grade file encryption in just 3 lines! $file = new FileHelper($_FILES['upload']['tmp_name'], 'secure/file.dat'); $file->secret = $encryptionKey; $file->moveAndEncrypt(); // AES-256-CBC + HMAC verification 🔐
🤖 AI-Ready Framework
- Dual AI Support:
AIAssist.jsonc
: Real-time AI coding assistanceGEMVCLibraryAPIReference.json
: Comprehensive API documentation
- Smart Code Completion: AI tools understand our library structure
- Intelligent Debugging: Better error analysis and fixes
- Future-Ready: Ready for emerging AI capabilities
⚡ Lightning-Fast Development
// Modern image processing in one line $image = new ImageHelper($uploadedFile)->convertToWebP(80); // Clean API responses $response = new JsonResponse()->success($data)->show(); // Type-safe database queries QueryBuilder::select('id', 'name') ->from('users') ->whereEqual('status', 'active') ->limit(10) ->run($pdoQuery);
🎈 Lightweight & Flexible
- Minimal Dependencies: Just 3 core packages
- Zero Lock-in: No rigid rules or forced patterns
- Cherry-Pick Features: Use only what you need
- Framework Agnostic: Works with any PHP project
🔥 Installation Options
1. Complete Project Setup
# Create a new project with full architecture
composer create-project gemvc/installer your_project_name
This will create a new project with the latest version (v5.9.14) and set up the complete directory structure.
2. Framework Only
# Add GEMVC Framework to an existing project
composer require gemvc/framework
This installs only the framework without the project structure.
3. Configure Your Magic
# Required .env configuration in your app folder: DB_HOST=localhost DB_PORT=3306 DB_NAME=your_db DB_CHARSET=utf8 DB_USER=root DB_PASSWORD='' # Security Settings TOKEN_SECRET='your_secret' TOKEN_ISSUER='MyCompany' REFRESH_TOKEN_VALIDATION_IN_SECONDS=43200 ACCESS_TOKEN_VALIDATION_IN_SECONDS=1200 # URL Configuration SERVICE_IN_URL_SECTION=2 METHOD_IN_URL_SECTION=3
4. Initialize Your Application
// index.php load(__DIR__.'/app/.env'); $webserver = new ApacheRequest(); $bootstrap = new Bootstrap($webserver->request);
🔗 Official Repository: gemFramework on GitHub
🚀 Quick Start
1. Configure Your Magic
# Database Configuration DB_HOST=localhost DB_NAME=your_db DB_USER=root DB_PASSWORD='yourPassword' # Security Settings TOKEN_SECRET='your_secret' TOKEN_ISSUER='your_api'
2. Start Building
// Create an API endpoint class Classroom extends APIService { public function __construct(Request $request) { parent::__construct($request); } public function create(): JsonResponse { $this->auth->authorize(['company-admin']); $this->validatePostWithCompany(['name'=>'string','course_id'=>'int','subject_id'=>'int','start_date'=>'date','end_date'=>'date','? location'=>'string','?description'=>'string']); return (new ClassroomController($this->request))->create(); } }
🚀 Quick Start
Project Initialization
// index.php require_once 'vendor/autoload.php'; use Gemvc\Core\Bootstrap; use Gemvc\Http\ApacheRequest; use Gemvc\Http\NoCors; use Symfony\Component\Dotenv\Dotenv; // Configure CORS NoCors::NoCors(); // Load environment configuration $dotenv = new Dotenv(); $dotenv->load(__DIR__.'/app/.env'); // Initialize framework $webserver = new ApacheRequest(); $bootstrap = new Bootstrap($webserver->request);
Required Configuration
Make sure your app/.env
file contains:
DB_HOST=localhost DB_NAME=your_db DB_USER=root DB_PASSWORD=secret
## 💪 Core Features
### 🏗️ Modern Architecture
- **Type Safety**: PHP 8.0+ features
- **Modular Design**: Clear separation of concerns
- **Smart Patterns**: Factory, Builder, Traits
- **Clean Structure**: Intuitive organization
### 🛡️ Security Features
- **Input Sanitization**: Automatic XSS prevention
- **Query Protection**: SQL injection prevention
- **File Security**: Path traversal protection
- **Email Safety**: Content security validation
### 🎯 Developer Tools
- **Query Builder**: Intuitive database operations
- **File Processing**: Secure file handling with encryption
- **Image Handling**: WebP conversion and optimization
- **Type System**: Comprehensive validation
### ⚡ Performance
- **Connection Pooling**: Smart database connections
- **Resource Management**: Efficient file streaming
- **Memory Optimization**: Smart image processing
- **Query Optimization**: Built-in performance features
## 📋 Requirements
- PHP 8.0+
- PDO Extension
- OpenSSL Extension
- GD Library
## 🎯 Perfect For
- **Microservices**: Specific, efficient functionality
- **Legacy Projects**: Add modern features
- **New Projects**: Full control from day one
- **Learning**: Clear, understandable code
## 📚 Documentation Links
- [Framework Documentation](Document.md)
- [Library Documentation](../library/Documentation.md)
- [AI Integration Guide](AIIntegration.md)
## 🔗 Related Projects
- [GEMVC Library](https://github.com/secure73/gemvc)
- [Framework Examples](https://github.com/secure73/gemvc-examples)
## About
**Author:** Ali Khorsandfard <ali.khorsandfard@gmail.com>
**GitHub:** [secure73/gemvc](https://github.com/secure73/gemvc)
**License:** MIT
---
*Made with ❤️ for developers who love clean, secure, and efficient code.*
*Built with GEMVC Library v3.27.8 - Making PHP development secure and enjoyable!*