madeawsri / lai-framework
A lightweight PHP framework
v1.0.0
2025-02-06 08:15 UTC
Requires
- duncan3dc/blade: ^4.14
- vlucas/phpdotenv: ^5.6
README
Lai Framework เป็น PHP framework ขนาดเล็กและเร็วที่พัฒนาโดยใช้แนวคิดของความเรียบง่ายและประสิทธิภาพสูง
Lai Framework
Lai Framework is a small, fast, and lightweight PHP framework designed for simplicity and performance. It allows developers to build web applications with minimal setup and effort while maintaining flexibility and scalability.
Features
- Fast and Lightweight: Built for speed and efficiency, reducing unnecessary processing.
- Modular Structure: Organize your app in modules, making it easy to extend without affecting core logic.
- Easy Routing: Simple routing system that handles HTTP requests and maps them to appropriate controllers.
- Blade Templating Engine: Uses Blade for easy view management, layouts, partials, and components.
- Helper Functions: Provides commonly used functions to simplify your codebase.
Directory Structure
demo/ ├── index.php # Entry point for the application ├── .htaccess # URL rewrite configuration (for Apache) ├── core/ │ └── Router.php # Router for dispatching routes ├── helpers/ │ └── Utility.php # Utility functions for general use ├── App/ │ └── Modules/ │ └── home/ │ ├── HomeCtrl.php # Controller for Home module │ └── views/ │ └── home.blade.php # View for Home module └── resources/ ├── views/ │ ├── layouts/ │ │ └── app.blade.php # Main layout for all pages │ ├── parts/ # Partials (e.g., header, footer) │ ├── components/ # Reusable components (e.g., alerts, cards) └── cache/ # Blade cache directory
Explanation:
index.php
: เป็นไฟล์ที่เริ่มต้นโปรเจคและจะทำหน้าที่ในการเรียกใช้งาน Router เพื่อจัดการ Routing.htaccess
: ไฟล์ตั้งค่าการ Rewrite URL ถ้าใช้ Apachecore/Router.php
: ควบคุมการ Route และการเรียก Controllerhelpers/Utility.php
: ฟังก์ชันที่ใช้ช่วยในโปรเจคทั่วไปApp/Modules/home/
: โมดูลสำหรับhome
ซึ่งประกอบด้วย Controller และ Viewresources/views/
: โฟลเดอร์ที่เก็บ Blade templateslayouts/
: Layout หลักของทุกๆ หน้าparts/
: Partial views เช่น header, footercomponents/
: Components ที่สามารถใช้ซ้ำได้ เช่น alert, cardcache/
: ที่เก็บ Cache ของ Blade