namespace App\Api;
use Gemvc\Core\ApiService;
use Gemvc\Http\Request;
use Gemvc\Http\JsonResponse;
use App\Controller\UserController;
class User extends ApiService {
public function __construct(Request $request) {
parent::__construct($request);
}
//API endpoint is https://yourdomain.com/api/user/getUsers
public function getUsers(): JsonResponse {
// Check if the user is admin
if (!$this->request->auth(['admin'])) {
return $this->request->returnResponse();
}
return (new UserController($this->request))->list();
}
}
GEMVC - Lightweight PHP Framework built for Microservices
Easy to Learn and implement but Well Documented, modern OpenSwoole/Apache/Nginx PHP library/framework to Build professional, High performant, Dockerized and secure Microservice APIs in minutes, not hours.
Install with Composer
composer require gemvc/library
Initialize GEMVC
php vendor/bin/gemvc init
Run with Docker
docker compose up -d --build
Core Features
Security by Principle
Built-in JWT authentication, input sanitization, and comprehensive protection against common vulnerabilities.
Webserver Agnostic
Seamlessly switch between OpenSwoole, Apache or Nginx servers! Your code works identically on all of them.
AI Ready
Built-in APIs and interfaces optimized for AI assistant integration and automation.
Super Light
Whole of GEMVC with its dependencies is under 2MB with very low memory footprint and minimal dependencies.
Database Abstraction
Type-safe queries, ORM capabilities, and table generation with connection pooling for maximum performance.
Postman Collection
Visit /index/documentation in your project root, download and import JSON file to start testing your APIs.
Library & Framework
Use it as a powerful library to modernize legacy projects, or as a complete framework for new applications.
Real-time Ready
WebSocket support with Redis scaling for real-time applications and live updates.
High Performance
OpenSwoole full support with Redis integration, GEMVC is built for high-traffic demands without code changes.
Type-Safe Architecture
Type-Safe from Request to Response lifecycle, in controller, model, and Database.
Powerful CLI
Project Initialization, DB Migration, and code generation based on your own coding style!
Easy Installation
With help of Composer and Docker, you can install and use GEMVC in your project in seconds.
Ready to Start Your Journey?
Begin with learning GEMVC and become an expert developer to build modern, secure PHP applications!
Gemvc Overview
Basic and fast understanding of Gemvc Philosophy, Architecture and Request Lifecycle, it helps to develop effective and efficient application
learn gemvc overviewHow To Write CRUD
Learn to create Create, Read, Update and Delete
- Create Endpoint (API)
- Create Controller
- Create Model (Data Logic)
- Create Table (Database abstraction)
Authentication
How to Authenticate and Authorize API users and requests with built-in JWT token
Setup AuthDo you need frontend for your project?
Try STCMS! Power of PHP and React under same roof!