aula72/malaika
最新稳定版本:v0.1.3
Composer 安装命令:
composer create-project aula72/malaika
包简介
Create any CRUD in seconds, this lightweight framework focuses on fast delievery of robust and reliable APIs. In software development security is always a base required this framework provides basic security with a room for improvement.
README 文档
README
Overview
This is a lightweight PHP RESTful framework designed to simplify API development. It follows MVC principles, provides easy routing, and supports middleware for enhanced security and flexibility.
Features
- Simple and clean routing
- JSON response handling
- Error handling and logging
- Database integration using PDO
- Authentication support (session-based)
- CORS support
Supported Database systems
- MySQL
- Postgres
- MongoDB
- Oracle
Installation
Manual Installation
- Clone the repository:
git clone https://github.com/Aula72/wu_php_api_simple_framework.git
orcomposer create-project aula72/malaika - Navigate to the project directory:
cd /path/to/files/clone - Install dependencies:
composer install
Usage
Configuration
Rename .env.example to .env for database and environment settings. Edit the .env file for configurations includingDB_TYPE to choose a database type you're are intending to use forexample DB_TYPE=postgres for Postgres, the default database system is MySQL; set in .env the database DBNAME and the user password DBPASSW and other additionals database connection settings.
Create tables in your database.
Running the Application
Start a development server:
php -S localhost:8000
Create your quick CRUD
Visit http://localhost:8000/auto-crud.php
A file name v1.php will be created containing all the necessary CRUD operations for your table.
Edit the index.php add include_once "v1.php" just be the line that has method_caller().
Now you can do CRUD on any table in your database by using the following endpoints
GET /<table-name>GET /<table-name>?<column-name>=67GET /<table-name>?<column-name1>=67&&<column-name2>=90POST /<table-name>PUT /<table-name>?<column-name>=67DELETE /<table-name>?<column-name>=67
Forexample if we have a database that has tables/models such as products, categories and product_categories then our endpoints will be as follows
GET /productsGET /products?id=3POST /productsPUT /products?id=2DELETE /products?id=5- so forth
If the table products has columns like id, name, category_id, unit_price and quantity then the post request will be in the following format
{"name":"Ice Cream", "category_id":3, "unit_price":5.90, "quantity": 89}
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature-name) - Commit your changes (
git commit -m 'Add feature') - Push to the branch (
git push origin feature-name) - Open a Pull Request
License
This project is licensed under the MIT License.
Contact
For support, open an issue or contact moncytod@gmail.com.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-25