PHPackages                             jardiscore/kernel - 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. jardiscore/kernel

ActiveLibrary

jardiscore/kernel
=================

DDD Kernel for PHP — BoundedContext, ContextResponse, DomainResponse, DomainKernel

v1.0.0(1mo ago)07↑2900%proprietaryPHPPHP &gt;=8.2CI passing

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/jardisCore/kernel)[ Packagist](https://packagist.org/packages/jardiscore/kernel)[ Docs](https://github.com/jardisCore/kernel)[ RSS](/packages/jardiscore-kernel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (3)Used By (0)

Jardis Kernel
=============

[](#jardis-kernel)

[![Build Status](https://github.com/jardisCore/kernel/actions/workflows/ci.yml/badge.svg)](https://github.com/jardisCore/kernel/actions/workflows/ci.yml/badge.svg)[![License: PolyForm Shield](https://camo.githubusercontent.com/d8fb46c82be4c5312bf3e372ac734dfdf6a8b328e9c2b2856af671adbb0600a5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d506f6c79466f726d253230536869656c642d626c75652e737667)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/a68b290dcc313d698dc138a1111aa83eee2f143605449d7e8b5416ea6f88558f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d3737374242342e737667)](https://www.php.net/)[![PHPStan Level](https://camo.githubusercontent.com/c51bda247654363d3e30bc352674dd761a9557803a14af0226eb411d6dc0006b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d627269676874677265656e2e737667)](phpstan.neon)[![PSR-12](https://camo.githubusercontent.com/34b10db0caa29bacd49bda5c437a8de95385f036f3230b31fa605326e18da22c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64652532305374796c652d5053522d2d31322d626c75652e737667)](phpcs.xml)[![PSR-3](https://camo.githubusercontent.com/ae4f449289821749d54eae0b7049d14a137e80da8c8afb5930859eca90bb5e92/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d332d4c6f672d626c75652e737667)](https://www.php-fig.org/psr/psr-3/)[![PSR-11](https://camo.githubusercontent.com/98be7eb7e57be670e94d2f798114804c0fa75a3c0435e17de37bee92cc966864/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d31312d436f6e7461696e65722d626c75652e737667)](https://www.php-fig.org/psr/psr-11/)[![PSR-14](https://camo.githubusercontent.com/ad320513b35a33c8e1b26659280cd1bdf4bbd3dbceabfdec8debaff5bea52295/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d31342d4576656e74253230446973706174636865722d626c75652e737667)](https://www.php-fig.org/psr/psr-14/)[![PSR-16](https://camo.githubusercontent.com/19b80673b3dc8065ce5caacac68f56ef79c8ed809ba2c017a36c6bb3ff37e039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d31362d53696d706c6525323043616368652d626c75652e737667)](https://www.php-fig.org/psr/psr-16/)[![PSR-18](https://camo.githubusercontent.com/07f2407c14b606d22023b8c5e970a3afd744e71d1b5b367df2cd29372c7ec9cb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d31382d48545450253230436c69656e742d626c75652e737667)](https://www.php-fig.org/psr/psr-18/)

> Part of the **[Jardis Business Platform](https://jardis.io)** — Enterprise-grade PHP components for Domain-Driven Design

DDD Kernel for PHP — Domain, DomainKernel, BoundedContext, ContextResponse, DomainResponse.

---

Overview
--------

[](#overview)

The DDD kernel with 7 files. Pull this package and start building domain logic immediately.

ClassPurpose`Domain`Base class for domain projects — kernel holder, entry point for BoundedContexts`DomainKernel`Simple kernel — constructor injection, immutable`BoundedContext`BC handler with PSR-11 Container + ClassVersion discovery`ContextResponse`Mutable transport accumulator for BC chains`DomainResponse`Immutable final response from domain operations`DomainResponseTransformer`ContextResponse tree → DomainResponse aggregation`ResponseStatus`Domain-neutral status enum (200, 400, 404, 500, ...)---

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

[](#installation)

```
composer require jardiscore/kernel
```

---

Quickstart
----------

[](#quickstart)

### 1. Create Kernel

[](#1-create-kernel)

```
use JardisCore\Kernel\DomainKernel;

$kernel = new DomainKernel(
    appRoot: __DIR__,
    domainRoot: __DIR__ . '/src',
    logger: $yourLogger,
    dbWriter: new PDO('mysql:host=localhost;dbname=shop', 'root', 'secret'),
);
```

### 2. Define a BoundedContext

[](#2-define-a-boundedcontext)

```
use JardisCore\Kernel\BoundedContext;
use JardisCore\Kernel\Response\DomainResponse;
use JardisCore\Kernel\Response\DomainResponseTransformer;

class PlaceOrder extends BoundedContext
{
    public function __invoke(): DomainResponse
    {
        $order = $this->payload();

        // Write to database
        $pdo = $this->resource()->dbWriter();
        $stmt = $pdo->prepare('INSERT INTO orders (customer, total) VALUES (?, ?)');
        $stmt->execute([$order['customer'], $order['total']]);

        // Collect result
        $this->result()->addData('orderId', (int) $pdo->lastInsertId());
        $this->result()->addEvent('OrderPlaced', $order);

        return (new DomainResponseTransformer())->transform($this->result());
    }
}
```

### 3. Use it

[](#3-use-it)

```
$context = new PlaceOrder($kernel, ['customer' => 'Acme', 'total' => 99.90]);
$response = $context();

$response->isSuccess();       // true
$response->getData();         // ['orderId' => 42]
$response->getEvents();       // [['OrderPlaced' => [...]]]
```

---

Advanced: Domain as Entry Point
-------------------------------

[](#advanced-domain-as-entry-point)

For real DDD projects, extend `Domain` to define your bounded contexts as a clean API. This is the pattern the Jardis Builder generates.

### 1. Define your Domain

[](#1-define-your-domain)

```
use JardisCore\Kernel\Domain;
use JardisPort\Kernel\DomainKernelInterface;

class Ecommerce extends Domain
{
    public function __construct(DomainKernelInterface $kernel)
    {
        parent::__construct($kernel);
    }

    public function order(): Order
    {
        return new Order($this->kernel());
    }

    public function catalog(): Catalog
    {
        return new Catalog($this->kernel());
    }
}
```

### 2. Define a BoundedContext

[](#2-define-a-boundedcontext-1)

```
use JardisCore\Kernel\BoundedContext;
use JardisCore\Kernel\Response\DomainResponse;
use JardisCore\Kernel\Response\DomainResponseTransformer;

class PlaceOrder extends BoundedContext
{
    public function __invoke(): DomainResponse
    {
        $order = $this->payload();

        $pdo = $this->resource()->dbWriter();
        $stmt = $pdo->prepare('INSERT INTO orders (customer, total) VALUES (?, ?)');
        $stmt->execute([$order['customer'], $order['total']]);

        $this->result()->addData('orderId', (int) $pdo->lastInsertId());
        $this->result()->addEvent('OrderPlaced', $order);

        return (new DomainResponseTransformer())->transform($this->result());
    }
}
```

### 3. Use it

[](#3-use-it-1)

```
$kernel = new DomainKernel(
    appRoot: __DIR__,
    domainRoot: __DIR__ . '/src',
    dbWriter: new PDO('mysql:host=localhost;dbname=shop', 'root', 'secret'),
    logger: $yourLogger,
);

$ecommerce = new Ecommerce($kernel);

$context = $ecommerce->order()->placeOrder(['customer' => 'Acme', 'total' => 99.90]);
$response = $context();

$response->isSuccess();   // true
$response->getData();     // ['orderId' => 42]
```

For zero-config bootstrapping (ENV-based kernel with auto-configured services), use `jardiscore/foundation` which extends `Domain` and builds the kernel automatically.

---

Architecture
------------

[](#architecture)

```
Domain (entry point — holds kernel, exposes bounded contexts)
    ↓
DomainKernel (infrastructure services)
    ↓
BoundedContext (use case handler)
    ↓
ContextResponse (mutable accumulator)
    ↓
DomainResponseTransformer
    ↓
DomainResponse (immutable answer)

```

---

Related Packages
----------------

[](#related-packages)

PackageRole`jardisport/kernel`Interface contracts (DomainKernelInterface, etc.)---

License
-------

[](#license)

Jardis is source-available under the [PolyForm Shield License 1.0.0](LICENSE.md). Free for virtually every purpose — including commercial use.

---

*Jardis – Development with Passion**Built by [Headgent Development](https://headgent.com)*

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance91

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

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

---

Top Contributors

[![Headgent](https://avatars.githubusercontent.com/u/245725954?v=4)](https://github.com/Headgent "Headgent (1 commits)")

---

Tags

kernelddddomainHeadgentbounded-contextjardisCore

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jardiscore-kernel/health.svg)

```
[![Health](https://phpackages.com/badges/jardiscore-kernel/health.svg)](https://phpackages.com/packages/jardiscore-kernel)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[windwalker/framework

The next generation PHP framework.

25639.1k1](/packages/windwalker-framework)

PHPackages © 2026

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