PHPackages                             open-genetics/framework - 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. [Framework](/categories/framework)
4. /
5. open-genetics/framework

ActiveProject[Framework](/categories/framework)

open-genetics/framework
=======================

Enterprise PHP Micro-Framework — JWT Auth, Genetic RBAC, Query Builder, i18n, Audit Trail, Testing Framework, and Dual-Frontend SDK

v2.3.0(2mo ago)136MITPHPPHP &gt;=8.1CI passing

Since Feb 22Pushed 2mo agoCompare

[ Source](https://github.com/jkstudio99/open-genetics)[ Packagist](https://packagist.org/packages/open-genetics/framework)[ Docs](https://github.com/open-genetics/framework)[ RSS](/packages/open-genetics-framework/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

 [![OpenGenetics Logo](public/images/logo/open-genetics-logo-white.svg)](public/images/logo/open-genetics-logo-white.svg)
OpenGenetics Framework
======================

[](#opengenetics-framework)

**Enterprise PHP Micro-Framework v2.2** — *Production-ready features built-in. No config bloat. Just PHP.*

 [![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE) [![PHP 8.1+](https://camo.githubusercontent.com/ffef5d1f571e5d96bbea4912578df5639371531f8341509b25302ee62ee305c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3838393242462e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php.net) [![MySQL](https://camo.githubusercontent.com/a6a197251b9e3348815d2ab8e8262b147e95c9909a5d9aa0e5c363f7a3c407a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d7953514c2d352e372532422d3434373941312e7376673f6c6f676f3d6d7973716c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/a6a197251b9e3348815d2ab8e8262b147e95c9909a5d9aa0e5c363f7a3c407a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d7953514c2d352e372532422d3434373941312e7376673f6c6f676f3d6d7973716c266c6f676f436f6c6f723d7768697465) [![v2.3.0](https://camo.githubusercontent.com/ffeeeaf5a062cba06fd3fc4f67b180beeb35faec96e8ba1162abda9057fd16a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e332e302d3663363366662e737667)](https://camo.githubusercontent.com/ffeeeaf5a062cba06fd3fc4f67b180beeb35faec96e8ba1162abda9057fd16a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e332e302d3663363366662e737667)

---

✨ What's New in v2.3
--------------------

[](#-whats-new-in-v23)

FeatureDescription🗃️ **Query Builder**`DB::table('users')->where('active',1)->paginate(20)` — fluent builder on PDO with prepared statements✅ **Guard::check()**Soft auth check — returns `bool` instead of throwing, perfect for optional-auth endpoints🏷️ **Cache::namespace()**Isolate cache key spaces between modules — `Cache::namespace('shop')->get('products')`🧪 **Testing: seed()**`$this->seed(['users' => [...]])` — seed test data within transaction rollback⏩ **Pipeline::after()**Post-response hooks for async side effects like audit logging🚫 **\#\[SkipMiddleware\]**`#[SkipMiddleware(CorsMiddleware::class)]` — exclude routes from global middleware📝 **LogMiddleware**Built-in request/response logging middleware🔌 **ErrorHandler::reporter()**`ErrorHandler::reporter(callable)` — hook for Sentry/Bugsnag integration---

✨ What's in v2.0
----------------

[](#-whats-in-v20)

\#FeatureDescription1⚡️ **Middleware Pipeline**`#[Middleware('auth', 'rate:10,60')]` declarative middleware with Chain of Responsibility2🗄️ **DB Migrations**Versioned, batch-rollback migrations with `migrate`, `migrate:rollback`, `migrate:status`3🧪 **Testing Framework**`GeneticTestCase` with HTTP client, `actingAsAdmin()`, `assertOk()`, `assertPaginated()`4🚀 **Caching Layer**File-based `Cache::remember()`, tag-based flush, zero dependencies5🔍 **Field Selector**`?fields=id,name,price` sparse fieldsets — GraphQL-lite without the server6📡 **Genetic Pulse**Server-Sent Events real-time push — no WebSocket server needed7🧩 **Genetic Modules**`GeneticModule` plugin system with auto-discovery and lifecycle hooks8🛠️ **Admin Generator**`make:admin ` — full CRUD admin endpoint from DB schema in seconds9🤖 **Endpoint AI**`make:endpoint-ai products "CRUD with auth and cache"` — NLP scaffold10🏪 **Marketplace**`market:install og/notifications` — community packages in one command> Plus all v1.0 features: JWT Auth, RBAC, i18n, Audit Trail, Dual SDK, File-based Routing, CLI, OpenAPI

---

🚀 Quick Start
-------------

[](#-quick-start)

```
# 1. Clone or create project
composer create-project open-genetics/framework my-api && cd my-api

# 2. Configure environment
cp .env.example .env
# Edit: DB_NAME, DB_USER, DB_PASS, JWT_SECRET

# 3. Bootstrap (tables + RBAC + admin user)
php genetics mutate

# 4. Start dev server
php genetics serve
# → http://127.0.0.1:8080
```

**Default admin:** `admin@opengenetics.io` / `password` *(change immediately in production)*

---

💻 Building an API Endpoint
--------------------------

[](#-building-an-api-endpoint)

Drop a file in `api/` — it's instantly a route. No registration needed.

```
// api/products.php  →  GET/POST /api/products

use OpenGenetics\Core\{Response, Cache};
use OpenGenetics\Core\DB;

#[\OpenGenetics\Core\Middleware('auth', 'rate:60,60')]
class Products
{
    public static function get(array $body): void
    {
        // Query Builder with caching
        $products = Cache::remember('products:all', 300, fn() =>
            DB::table('products')->where('active', 1)->paginate(20)
        );
        Response::success($products);
    }

    public static function post(array $body): void
    {
        // AI-assisted scaffold: php genetics make:endpoint-ai products "with auth and audit"
        Response::success(null, 'Created', 201);
    }
}
```

Or scaffold in seconds:

```
php genetics make:endpoint-ai products "CRUD with auth, search, pagination and cache"
```

---

🖥️ CLI — 25+ Commands
---------------------

[](#️-cli--25-commands)

```
Database:    mutate, seed, status, serve
Migrations:  migrate, migrate:rollback, migrate:status
Scaffold:    make:endpoint, make:middleware, make:migration,
             make:test, make:admin, make:endpoint-ai
Cache:       cache:clear, cache:stats, cache:gc
Marketplace: market:list, market:search, market:install
Modules:     modules:list
Docs:        docs:generate
Info:        help, --version, new

```

---

🏗️ Project Structure
--------------------

[](#️-project-structure)

```
my-api/
├── api/                    # File-based routing (1 file = 1 endpoint)
│   └── auth/               # Auth routes (login, register, logout)
├── src/Core/               # Framework core (PSR-4, PHP 8.1+)
│   ├── QueryBuilder.php    # Fluent Query Builder (v2.2)
│   ├── Cache.php           # Caching layer with namespace support (v2.2)
│   ├── FieldSelector.php   # GraphQL-lite sparse fieldsets
│   ├── Pulse.php           # Server-Sent Events
│   ├── ModuleLoader.php    # Plugin system
│   ├── AdminGenerator.php  # Admin endpoint scaffolder
│   ├── EndpointAI.php      # AI endpoint generator
│   ├── Marketplace.php     # Package registry
│   ├── Pipeline.php        # Middleware pipeline with Pipeline::after()
│   ├── Migrator.php        # DB migrations
│   ├── Database.php        # PDO Singleton
│   ├── Router.php          # File-based router
│   └── Response.php        # JSON response helpers
├── src/Auth/               # JWT + Guard RBAC (Guard::check() v2.2)
├── src/Testing/            # GeneticTestCase + TestResponse + seed()
├── src/Middleware/         # Auth, CORS, RateLimit, LogMiddleware
├── database/migrations/    # Versioned migration files
├── modules/                # Genetic Modules (plugins)
├── storage/cache/          # File cache store
├── sdk/                    # Frontend SDK (React + Vanilla JS)
├── locales/                # i18n dictionaries (en.json, th.json)
├── genetics                # CLI tool
├── public/                 # Web root (index.php)
└── .env                    # Environment config

```

---

🔥 Feature Highlights
--------------------

[](#-feature-highlights)

### Query Builder (v2.2)

[](#query-builder-v22)

```
$users = DB::table('users')
    ->select(['id', 'email', 'role_name'])
    ->where('is_active', 1)
    ->where('tenant_id', $tenantId)
    ->orderBy('created_at', 'DESC')
    ->paginate(20);
```

### Middleware Pipeline

[](#middleware-pipeline)

```
#[Middleware('auth:ADMIN', 'rate:10,60')]
class AdminProducts { ... }
```

### Guard::check() — Optional Auth (v2.2)

[](#guardcheck--optional-auth-v22)

```
if (Guard::check()) {
    $user = Guard::user(); // personalized response
} else {
    // public response
}
```

### Database Migrations

[](#database-migrations)

```
php genetics migrate            # Run pending
php genetics migrate:rollback   # Undo last batch
php genetics make:migration add_image_to_products
```

### Testing Framework

[](#testing-framework)

```
class ProductsTest extends GeneticTestCase {
    public function testList(): void {
        $this->actingAsAdmin();
        $this->seed(['products' => [['name' => 'Test', 'active' => 1]]]);
        $this->get('/api/products')->assertOk()->assertPaginated();
    }
}
```

### Field Selector (GraphQL-lite)

[](#field-selector-graphql-lite)

```
GET /api/products?fields=id,name,price,category.name

```

### Real-time SSE

[](#real-time-sse)

```
Pulse::broadcast('orders', ['id' => 123, 'status' => 'new']);
// Client: const es = new EventSource('/api/events');
```

### Marketplace

[](#marketplace)

```
php genetics market:search notifications
php genetics market:install og/notifications
```

---

📚 Documentation
---------------

[](#-documentation)

Full documentation: open `docs/site/overview.html` or browse the 26-page docs site.

```
# Regenerate docs
cd docs/_tools && python3 _gen_pages.py
```

---

🛡️ Security
-----------

[](#️-security)

Report vulnerabilities to `security@opengenetics.io` — do not use the issue tracker.

📄 License
---------

[](#-license)

MIT License — free and open-source. See [LICENSE](LICENSE).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance84

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

14

Last Release

83d ago

Major Versions

v1.0.5 → v2.0.012026-02-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/c80d104b51f12b8625d08536019f8b57e1ff4f943dfcc31f4cc69a3e984376bf?d=identicon)[lowcost01](/maintainers/lowcost01)

---

Top Contributors

[![jkstudio99](https://avatars.githubusercontent.com/u/143254106?v=4)](https://github.com/jkstudio99 "jkstudio99 (81 commits)")

---

Tags

phpjwtframeworki18nrbacREST APIPSR-4audit-trailmicro-framework

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/open-genetics-framework/health.svg)

```
[![Health](https://phpackages.com/badges/open-genetics-framework/health.svg)](https://phpackages.com/packages/open-genetics-framework)
```

###  Alternatives

[phalcon/phalcon

Phalcon Framework

2421.5k1](/packages/phalcon-phalcon)[richarddobron/fbt

An Internationalization Framework for PHP.

1512.0k2](/packages/richarddobron-fbt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
