jcarrasco96/my-api-rest 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jcarrasco96/my-api-rest

Composer 安装命令:

composer require jcarrasco96/my-api-rest

包简介

PHP library for creating secure and simple REST APIs.

README 文档

README

PHP

Ask DeepWiki

📝 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

  1. Clone this repository
    git clone https://github.com/Jcarrasco96/my-api-rest.git
    
  2. 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"
        }
      ]
    }
  3. 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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2025-06-22