Effortlessly Build High-Performance APIs in PHP

Lightweight, Rapid API Development Kit, optimised for FrankenPHP Workers and ready to run on Kubernetes.

config/kipchak.api.php
composer.json
// config/kipchak.api.php
return [
'name' => 'your-api', // Hyphen or underscore separated string
'debug' => (bool) env('DEBUG', true),
'logExceptions' => true,
'logExceptionDetails' => true,
// If debug is enabled, loglevel is debug. Otherwise, it is info. Overwrite it by specifying it below.
// 'loglevel' => \Monolog\Level::Debug
];

Introduction

Getting started

Prayer to get started - In the name of God, the Most Beneficient, the Most Merciful

Kipchak is designed for developers who want a minimal, extensible, yet robust foundation for building high-performance APIs in PHP.

It complies with PHP Standards Recommendations (PSRs) for code interoperability and has modular architecture, making it easy to extend and maintain.

It is battle tested on APIs serving over 3,000 requests per second and uses up to 60% less resources than similar APIs built with larger frameworks like Symfony / Laravel running on Apache / FPM.

Use Kipchak's pre-built drivers and middlewares to help you get production ready with just a few lines of code.

Kipchak is developed by Mamluk LLC in the United Arab Emirates.

NOTE: This documentation is always relevant for the latest major Kipchak version (which is currently 2.x). For how to upgrade, please see the Upgrade Guide.

High Performance

Leverage Caddy and FrankenPHP in worker mode for blazing fast response times.

Deployment

Fully containerised and Kubernetes ready out of the box.

Drivers

Extend Kipchak with custom drivers for databases, storage, and more.

Middleware

Use pre-built or custom build middleware to handle requests and responses.


Why Kipchak?

Kipchak provides a solid structure for your PHP APIs without the overhead of larger frameworks. It only adds a handful of files on top of Slim Framework to bootstrap effectively and add formal structure around initialising Drivers and Middleware.

Key Features

  • Lightweight: Built on Slim Framework 4.
  • High Performance: Runs on Caddy and Optimized for FrankenPHP's worker mode.
  • Container Ready: Comes with Docker and Kubernetes configurations.
  • Extensible: Modular driver and middleware system.
  • Configuration Driven: Centralised configuration for easy management.
  • Helper Components: Includes built-in components for formatted API responses and a base Controller.
  • PSR Interoperability: Kipchak is PHP at its best - you don't have to learn a new framework to use it.

Requirements

  • Docker - this is enough if you just want to run in the container. Use the Git installation method below.
  • PHP 8.4+
  • Composer - Get this at http://packagist.org. This will allow you to use the Composer installation method below.

Installation

To get started with Kipchak, you can use composer or just clone the starter project:

Using Composer

composer create-project kipchak/starter [my-api]

Using Git

git clone https://1x.ax/mamluk/kipchak/starter.git my-api
cd my-api && rm -rf .git
composer install

Running with Docker (the recommened way)

Kipchak is designed to be run with Docker (or in a container). You can start the development environment using:

docker compose up --build --watch

This will start the application using FrankenPHP's worker mode, providing a high-performance environment right from the start.

It will also automatically hot reload the PHP worker when changes are detected.

Check it out by visiting http://localhost/status in your browser.

Lear more about the starter project here.

If you are starting up for the first time, you might see some errors from the CouchDB container. Run the following from your terminal to create the requisite databases:

curl -X PUT http://api:api@localhost:5984/_users
curl -X PUT http://api:api@localhost:5984/api

Core Project

The core logic of Kipchak is maintained in a separate repository to ensure easy updates and a clean separation of concerns. You will see this repository as kipchak/core in your project's composer.json file alongside the other drivers and middleware that come pre-packaged into the starter project.

You can find the core project's source code at https://1x.ax/mamluk/kipchak/core.

See the Core Project section for more information.