GEMVC Documentation
Complete guide to building modern, secure PHP applications with GEMVC framework
🚀 Quick Start Guide
Welcome to GEMVC! This guide will help you get your first API up and running in minutes.
Zero to Running in 60 Seconds
1. GEMVC Installation
1. Install GEMVC and initialize your project:
Terminal
composer require gemvc/library
Tip: be sure you have installed composer and php 8.0 or higher
2. Initialize your project:
Terminal
vendor/bin/gemvc init
3. Start the development environment (Docker recommended):
Terminal
docker-compose up --build
Tip: GEMVC comes with a ready-to-use Docker setup (PHP, MySQL, Redis, PHPMyAdmin). No manual config needed!
2. Initialize Database
following command will create database in your Mysql :
Terminal
vendor/bin/gemvc db:init
3.Create Your First API
Generate a complete CRUD API for a resource:
Terminal
vendor/bin/gemvc create:crud Product
This creates:
app/api/Product.php
API endpoints for your resource
app/controller/ProductController.php
Business logic and request handling
app/model/ProductModel.php
Data model for your resource
app/table/ProductTable.php
Database schema definition
3.Create table in Database
Generate Table in Database based on your Table-Layer (in this case app/table/ProductTable.php class):
Terminal
vendor/bin/gemvc db:migrate ProductTable
Tip: if you want to see table structure you created in database, you can use following command:
Terminal
vendor/bin/gemvc db:describe products
info: GEMVC Table Layer classes have special method getTable() that returns table name , you can define your table name inside this method
4. Test Your API
Try your endpoint:
Terminal
curl http://localhost:9501/api/product/list
Tip: if you choose openswoole as webserver, port is localhost:9501 in apache is localhost:80
Or visit the auto-generated API docs.
Sample response:
JSON
{
"response_code": 200,
"message": "OK",
"count": 0,
"service_message": "list of products fetched successfully"
"data": [],
}