PHPackages                             kunlare/php-api-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. kunlare/php-api-engine

ActiveLibrary

kunlare/php-api-engine
======================

Framework-agnostic RESTful CRUD API generator for MySQL/MariaDB with multi-mode authentication (Basic, API Key, JWT)

01↓100%PHPCI passing

Since Apr 6Pushed yesterdayCompare

[ Source](https://github.com/kunlare/php-api-engine)[ Packagist](https://packagist.org/packages/kunlare/php-api-engine)[ RSS](/packages/kunlare-php-api-engine/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP API ENGINE
==============

[](#php-api-engine)

[![PHP](https://camo.githubusercontent.com/1a5e13126d38c1d05f712dae30e7f60ae0444a9c882e9e526349ccba27facb8d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e312d626c7565)](https://camo.githubusercontent.com/1a5e13126d38c1d05f712dae30e7f60ae0444a9c882e9e526349ccba27facb8d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e312d626c7565)[![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)[![Version](https://camo.githubusercontent.com/8799d8eff2c6d6038b1674f5971bc903f93acc1cd1174db033675f834fcc7ea7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d6f72616e6765)](https://camo.githubusercontent.com/8799d8eff2c6d6038b1674f5971bc903f93acc1cd1174db033675f834fcc7ea7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d6f72616e6765)

A framework-agnostic RESTful CRUD API generator for MySQL/MariaDB with multi-mode authentication (Basic Auth, API Key, JWT).

Features
--------

[](#features)

- **Automatic CRUD endpoints** for any MySQL table
- **Multi-mode authentication**: Basic Auth, API Key, JWT
- **User management** with role-based access (admin, user, developer)
- **Schema builder** for creating/altering tables programmatically
- **Query builder** with fluent API and filter support
- **CORS support** with configurable origins
- **Input validation** with extensible rules
- **CLI setup tool** for initial configuration
- **Standardized JSON responses** with pagination metadata
- **Message queues** with inbound (job), outbound pull, and outbound push (webhook) delivery
- **Secure by default**: prepared statements, password hashing, token-based auth

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- ext-pdo
- ext-json
- MySQL 5.7+ or MariaDB 10.3+

Installation
------------

[](#installation)

```
composer require kunlare/php-api-engine
```

Quick Start
-----------

[](#quick-start)

### 1. Configure Environment

[](#1-configure-environment)

Copy the example configuration and edit it:

```
cp vendor/kunlare/php-api-engine/examples/.env.example .env
```

Edit `.env` with your database credentials:

```
DB_HOST=localhost
DB_PORT=3306
DB_NAME=your_database
DB_USER=root
DB_PASSWORD=your_password
JWT_SECRET=your-random-secret-key-at-least-32-characters
```

### 2. Run Setup

[](#2-run-setup)

```
php vendor/bin/setup.php
```

This will:

- Verify your `.env` configuration
- Test the database connection
- Create `users` and `api_keys` tables
- Prompt you to create an admin account
- Generate a JWT token for first access

### 3. Create Entry Point

[](#3-create-entry-point)

Create `index.php`:

```
