Tick PHP is a lightweight, convention-over-configuration PHP framework designed for speed and simplicity. It brings the best of modern development practices—like Auto-Discovery, Dependency Injection, and JWT Authentication—to native PHP without the bloat.
Created by Alvian Zachry Faturrahman.
🌐 Website: https://alvianzf.id
- Auto-Discovery Routing: No route files. Your Controller methods define your API.
- Dependency Injection: Built-in Container auto-wires your Controllers, Services, and Repositories.
- Database Agnostic:
- SQL ORM: Fluent API using PDO (MySQL, SQLite, Postgres).
- NoSQL ODM: File-based or MongoDB support via
Documentclass.
- Central Configuration: Simple
config/system. - Zero-Dependency JWT: Native, secure HS256 Token Authentication.
- Auto Documentation: Generates
swagger.jsonand Markdown docs automatically. - Powerful CLI: Generate resources, run server, and build docs with
tick.
-
Clone the repository:
git clone https://github.com/alvianzf/tick-php-framework.git cd tick-php-framework -
Install dependencies:
composer install # OR composer dump-autoload -
Start the server:
php tick serve
Your API is now running at
http://localhost:8080.
The tick tool is your best friend.
| Command | Description |
|---|---|
php tick |
Start the development server (default port 8080). |
php tick --port 3000 |
Start server on a specific port. |
php tick g <name> |
Generate a Resource (Controller, Service, Repo, Model). |
php tick g jwt |
Scaffolds the complete Authentication module. |
php tick g swagger |
Generates swagger.json (OpenAPI 3.0). |
php tick g docs |
Generates API_DOCS.md (Markdown). |
You don't define routes manually. Tick scans your app/ folder.
Structure:
app/
Users/
UsersController.php
| Method | HTTP Verb | Route |
|---|---|---|
findAll |
GET |
/users |
findOne |
GET |
/users/:id |
create |
POST |
/users |
update |
POST |
/users/:id |
remove |
DELETE |
/users/:id |
Use constructor injection to manage dependencies. The Container handles the rest.
use App\Users\UsersService;
class UsersController {
protected $service;
// Automatic Injection
public function __construct(UsersService $service) {
$this->service = $service;
}
}Tick PHP supports multiple database connections out of the box.
Edit config/database.php to configure your connections.
- SQL: MySQL, PostgreSQL, SQLite (via
PDODriver). - NoSQL: MongoDB (via
MongoDriver), JSON Files (viaJsonDriver).
To switch the default connection:
// config/database.php
'default' => 'mysql',For relational databases.
-
Define a Model:
namespace App\Users; use Tick\Database\Model; class Users extends Model { protected $table = 'users'; // Optional: Override connection for this specific model // protected $connection = 'pgsql'; }
-
Use it:
// Create Users::create(['name' => 'John', 'email' => 'john@doe.com']);
For document storage.
-
MongoDB Setup:
composer require mongodb/mongodb
Then configure the
mongodbconnection inconfig/database.php. -
Define a Document:
use Tick\Database\Document; class Log extends Document { protected $collection = 'logs'; // Optional: Use MongoDB instead of JSON protected $connection = 'mongodb'; }
-
Generate Auth Module:
php tick g jwt
-
Protect Routes: Use the
AuthMiddlewarein your controller.use Tick\Middleware\AuthMiddleware; public function secret($req, $res) { (new AuthMiddleware())->handle($req, $res); $res->json(['user' => $req->user]); }
Never write docs manually again.
- Swagger:
php tick g swagger-> Imports into Postman/Swagger UI. - Markdown:
php tick g docs-> ReadableAPI_DOCS.mdfor GitHub.
This project is open-sourced software licensed under the MIT license.