jcarrasco96/my-api-rest
Composer 安装命令:
composer require jcarrasco96/my-api-rest
包简介
PHP library for creating secure and simple REST APIs.
关键字:
README 文档
README
📝 Description
This project is a RESTful microframework written in pure PHP, designed for developing modern APIs in a simple, organized way without external dependencies. It includes dynamic controllers by convention, permission checking via attributes, access control, and request limits (RateLimit).
🚀 Features
✅ Versioned Controllers
✅ Dynamic Routing
✅ Custom Attributes
✅ Permission Checking and JWT
✅ Request Limiting
✅ Layer Separation
✅ No External Dependencies
📁 Project structure
/attributes/
/console/
/core/
/db/
/exceptions/
/languages/
/query/
/rest/
/validators/
composer.json
LICENSE.md
README.md (this file)
🔧 Requirements
✅ PHP >=8.2
✅ Apache or Nginx server (friendly URLs)
✅ PDO extension enabled
✅ File system access (for logs and rate limiting)
⚙️ Example of use of Rate Limit Checker
#[RateLimit(limit: 10, seconds: 60)] #[Route('auth/login', [Route::ROUTER_POST])] public function actionLogin(): string { // Login logic and token generation }
📡 Example routes
GET /v1/user
POST /v1/user
GET /v1/product/5
The URL automatically determines the controller and method.
📥 Installation
- Clone this repository
git clone https://github.com/Jcarrasco96/my-api-rest.git - In composer.json of main application merge:
{ "require": { "jcarrasco96/simple-api-rest": "1.0.*@dev" }, "repositories": [ { "type": "path", "url": "path\\to\\my-api-rest\\src" } ] } - In index.php of main application
require_once 'vendor/autoload.php'; $config = require_once 'config/rest.php'; // config file (new Rest($config))->run();
🪤 Pull requests are welcome
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2025-06-22