DEV Community

Md Rasheduzzaman
Md Rasheduzzaman

Posted on

πŸš€ Building a Production-Ready PHP REST API Framework (Open Source)


After building and managing 25+ enterprise applications (ERP, HRM, CRM, LMS, SaaS), I realized most PHP frameworks are powerful but heavy for small, API-only or microservice projects.

So, I decided to build a custom, production-ready REST API framework in raw PHP β€” clean, lightweight, and fully modular β€” now open-sourced on GitHub! πŸŽ‰

βš™οΈ Why I Built This

I wanted complete control over every layer: routing, middleware, authentication, and performance.

I needed something faster and leaner than Laravel for internal APIs and microservices.

I wanted to learn deeply how an API framework works under the hood β€” HTTP handling, dependency injection, error management, and versioning.

🧩 Framework Highlights

βœ… Lightweight & Fast – built on raw PHP 8+, PSR-4 autoloading
βœ… JWT Authentication – secure token-based access
βœ… Clean Modular Structure – controllers, routes, middleware
βœ… Built-in CLI & Job Queue System
βœ… Debug Mode – track queries, memory, and response time
βœ… API Versioning Support
βœ… Error Handling, CORS, and Rate Limiting
βœ… Ready for Docker & Production

πŸ— Folder Structure Example
app/
β”œβ”€β”€ core/
β”œβ”€β”€ controllers/
β”œβ”€β”€ middleware/
β”œβ”€β”€ models/
β”œβ”€β”€ routes/
β”œβ”€β”€ storage/
public/
└── index.php

This structure keeps everything modular, testable, and scalable.

🧠 Learn the Full Process

I documented every step β€” from architecture planning to deployment β€” in this detailed Medium article:
πŸ‘‰ Building a Production-Ready PHP REST API Framework β€” A Complete Guide

πŸ’» Explore the Source Code

You can explore, fork, or contribute on GitHub:
πŸ‘‰ https://github.com/jmrashed/php-rest-api-pro-kit

🀝 Contribute & Feedback

I’d love your feedback and suggestions!
If you find it useful:

⭐ Star the repo

πŸ› Report issues

πŸ’¬ Share ideas to improve

Let’s make this the go-to starting point for developers who want to build fast, clean, production-ready APIs with PHP!

Top comments (2)

Collapse
 
linjunjie525 profile image
Lin JunJie

This is a truly impressive piece of work!
Building a custom PHP REST framework from scratch is truly in-depth and demonstrates exceptional skill.
I love the modular design and focus on performance. Be sure to check out the repository!

Collapse
 
mrzstack profile image
Md Rasheduzzaman

Thank you so much! πŸ™
I really appreciate your thoughtful feedback.
It means a lot to know the effort behind building this PHP REST framework is being recognized.
I focused heavily on modularity, scalability, and developer experience β€” glad that stood out!
Feel free to explore the repo and share any suggestions or ideas for improvement. πŸš€