jcarrasco96 / my-api-rest
PHP library for creating secure and simple REST APIs.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/jcarrasco96/my-api-rest
Requires
- php: >=8.2
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-pdo: *
- phpmailer/phpmailer: ^6.10
This package is auto-updated.
Last update: 2025-12-05 17:21:25 UTC
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();