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

ActiveLibrary[Framework](/categories/framework)

jardiscore/foundation
=====================

Jardis Foundation — thin convenience layer that builds DDD services from ENV

v1.0.0(3w ago)044MITPHPPHP &gt;=8.2CI passing

Since Jun 1Pushed 2w agoCompare

[ Source](https://github.com/jardisCore/foundation)[ Packagist](https://packagist.org/packages/jardiscore/foundation)[ Docs](https://docs.jardis.io/en/core/foundation)[ RSS](/packages/jardiscore-foundation/feed)WikiDiscussions main Synced 3w ago

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

Jardis Foundation
=================

[](#jardis-foundation)

[![Build Status](https://github.com/jardisCore/foundation/actions/workflows/ci.yml/badge.svg)](https://github.com/jardisCore/foundation/actions/workflows/ci.yml/badge.svg)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](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/8ec91610a7e9f5a2cf45a8364134f116ceff76ab77343dfb7f4a190e8b70c66e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d332d4c6f676765722d626c75652e737667)](https://www.php-fig.org/psr/psr-3/)[![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

---

The Integration Platform for Jardis DDD Projects
------------------------------------------------

[](#the-integration-platform-for-jardis-ddd-projects)

**Jardis Foundation** is the runtime heart of every Jardis DDD project. It connects the full power of the Jardis ecosystem — database connections, caching, logging, event dispatching, HTTP communication — into a single, ENV-driven entry point.

When you generate a DDD project with the **Jardis Builder**, the resulting code extends `JardisApp`. Foundation takes care of assembling all infrastructure services so your domain code stays clean, portable and focused on business logic.

### What Foundation delivers

[](#what-foundation-delivers)

- **Pure Hexagonal Architecture** — your domain core has zero knowledge of infrastructure. Foundation wires adapters behind PSR interfaces, respecting the Dependency Inversion Principle at every layer.
- **Seamless Builder Integration** — the Jardis Builder generates BoundedContexts, Aggregates, Repositories and Commands that run on Foundation out of the box. No manual wiring, no bootstrap ceremony.
- **Jardis Ecosystem in one place** — Foundation brings together 8+ specialized Jardis packages (Kernel, Cache, DbConnection, Logger, EventDispatcher, HTTP, Mailer, Filesystem) through a unified ENV configuration. Install what you need, ignore what you don't.
- **Convention over Configuration** — a single `.env` file replaces hundreds of lines of container configuration. Every service auto-assembles from environment variables.
- **PSR-compliant throughout** — PSR-3 (Logger), PSR-14 (Event Dispatcher), PSR-16 (Cache), PSR-18 (HTTP Client). Your domain code depends on standards, never on implementations.

### From Builder to running application

[](#from-builder-to-running-application)

```
Jardis Builder                     Jardis Foundation
─────────────                      ─────────────────
Generates:                         Provides at runtime:
  BoundedContexts                    Database (PDO / ConnectionPool)
  Aggregates + Entities              Redis (shared connection)
  Repositories + Pipeline            Cache (multi-layer: memory, apcu, redis, db)
  Commands + Queries                 Logger (multi-handler: file, slack, loki, ...)
  Domain Events                      Event Dispatcher (PSR-14)
         │                           HTTP Client (PSR-18)
         │                           Mailer (SMTP)
         │                           Filesystem (Local + S3)
         │                                    │
         └──── extends JardisApp ─────────────┘

```

---

DomainApp vs. JardisApp
-----------------------

[](#domainapp-vs-jardisapp)

`DomainApp` (Kernel)`JardisApp` (Foundation)**Package**`jardiscore/kernel``jardiscore/foundation`**Dependencies**Only Kernel + PSR interfacesKernel + optional adapters**Services**Override hooks manuallyHooks filled from ENV**Use when**Full control, own infrastructureJardis ecosystem, Builder projects```
// Full control — wire everything yourself:
class Ecommerce extends DomainApp { }

// Jardis ecosystem — services from .env:
class Ecommerce extends JardisApp { }
```

---

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

[](#installation)

```
composer require jardiscore/foundation
```

Optional adapters — install only what you need:

```
composer require jardisadapter/cache             # Multi-layer caching (Memory, APCu, Redis, Database)
composer require jardisadapter/dbconnection      # ConnectionPool with read/write splitting
composer require jardisadapter/logger            # Log handlers (File, Slack, Teams, Loki, etc.)
composer require jardisadapter/eventdispatcher   # PSR-14 Event Dispatching
composer require jardisadapter/http              # PSR-18 HTTP Client with handler pipeline
composer require jardisadapter/mailer            # SMTP Mailer with STARTTLS, AUTH, HTML/Text
composer require jardisadapter/filesystem        # Local + S3 filesystem abstraction
```

---

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

[](#quick-start)

### 1. Create a `.env` in your domain root

[](#1-create-a-env-in-your-domain-root)

```
DB_DRIVER=mysql
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=secret
DB_DATABASE=shop

REDIS_HOST=localhost

CACHE_LAYERS=memory,redis
LOG_HANDLERS=file:INFO,console:DEBUG
LOG_CONTEXT=shop
LOG_FILE_PATH=/var/log/shop.log

HTTP_BASE_URL=https://api.payment.example.com
HTTP_BEARER_TOKEN=pk_live_...
```

### 2. Extend JardisApp

[](#2-extend-jardisapp)

```
use JardisCore\Foundation\JardisApp;

class Ecommerce extends JardisApp
{
    public function order(): PlaceOrder
    {
        return new PlaceOrder($this->kernel());
    }
}
```

### 3. Use it

[](#3-use-it)

```
$shop = new Ecommerce();
$response = $shop->order()(['customer' => 'Acme', 'total' => 99.90]);

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

That's it. No bootstrap file. No container setup. Services assembled from `.env`.

---

ENV Configuration
-----------------

[](#env-configuration)

### Database

[](#database)

```
DB_DRIVER=mysql          # mysql|pgsql|sqlite
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=secret
DB_DATABASE=myapp
DB_CHARSET=utf8mb4

# Optional: Read Replicas (auto-builds ConnectionPool when jardisadapter/dbconnection is installed)
DB_READER1_HOST=replica1
DB_READER2_HOST=replica2
# Missing values inherit from writer
```

### Redis (shared between cache and logger)

[](#redis-shared-between-cache-and-logger)

```
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DATABASE=0
```

### Cache

[](#cache)

```
# Available layers: memory, apcu, redis, db (order = lookup priority, left first)
CACHE_LAYERS=memory,redis,db
CACHE_NAMESPACE=myapp
CACHE_DB_TABLE=cache         # only for db layer
```

### Logger

[](#logger)

```
# Handlers: file, console, errorlog, syslog, browserconsole, redis, slack, teams, loki, webhook, null
# Manual (via hook override): database, email, stash, redismq, kafkamq, rabbitmq
# Levels: DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
# Syntax: handler:LEVEL,handler:LEVEL
LOG_HANDLERS=file:ERROR,console:DEBUG
LOG_CONTEXT=myapp
LOG_FILE_PATH=/var/log/app.log
#LOG_SLACK_URL=
#LOG_TEAMS_URL=
#LOG_LOKI_URL=
#LOG_WEBHOOK_URL=
```

### Event Dispatcher

[](#event-dispatcher)

No ENV configuration needed — the PSR-14 event dispatcher is a pure in-memory service. Install `jardisadapter/eventdispatcher` and it's available automatically.

### HTTP Client

[](#http-client)

```
HTTP_BASE_URL=https://api.example.com
HTTP_TIMEOUT=30
HTTP_CONNECT_TIMEOUT=10
HTTP_VERIFY_SSL=true

# Authentication (one of):
HTTP_BEARER_TOKEN=
HTTP_BASIC_USER=
HTTP_BASIC_PASSWORD=

# Retry (optional):
HTTP_MAX_RETRIES=3
HTTP_RETRY_DELAY_MS=100
```

---

Hook Overrides
--------------

[](#hook-overrides)

JardisApp fills hooks from ENV — but you can override any of them:

```
class Ecommerce extends JardisApp
{
    // Own cache instead of ENV-based:
    protected function cache(): CacheInterface|false|null
    {
        return new MySpecialCache();
    }

    // Rest (connection, redis, logger, eventDispatcher, httpClient, mailer, filesystem) still comes from ENV
}
```

Three-state resolution (inherited from DomainApp):

ReturnMeaning**object**Use this service. Share it with other DomainApps (first-write-wins).**null**No local service. Use shared from another DomainApp if available.**false**Explicitly disabled. Don't use shared fallback.---

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

[](#architecture)

```
DomainApp (jardiscore/kernel)
    |
JardisApp (jardiscore/foundation) extends DomainApp
    |-- connection()       -> ConnectionHandler       -> PDO or ConnectionPool from ENV
    |-- redis()            -> RedisHandler            -> shared Redis from ENV
    |-- cache()            -> CacheHandler            -> multi-layer Cache (PSR-16)
    |-- logger()           -> LoggerHandler           -> multi-handler Logger (PSR-3)
    |-- eventDispatcher()  -> EventDispatcherHandler  -> Event Dispatcher (PSR-14)
    |-- httpClient()       -> HttpClientHandler       -> HTTP Client (PSR-18)
    |-- mailer()           -> MailerHandler           -> SMTP Mailer
    |-- filesystem()       -> FilesystemHandler       -> Filesystem Factory

```

### Directory Structure

[](#directory-structure)

```
src/
├── JardisApp.php                      # Extends DomainApp, overrides service hooks
├── Data/
│   ├── CacheLayer.php                 # Enum: memory, apcu, redis, db
│   └── LogHandler.php                 # Enum: file, console, errorlog, syslog, ...
└── Handler/
    ├── ConnectionHandler.php          # DB_* -> PDO or ConnectionPool
    ├── RedisHandler.php               # REDIS_* -> shared Redis connection
    ├── CacheHandler.php               # CACHE_LAYERS -> multi-layer Cache
    ├── LoggerHandler.php              # LOG_HANDLERS -> multi-handler Logger
    ├── EventDispatcherHandler.php     # -> PSR-14 Event Dispatcher
    ├── HttpClientHandler.php          # HTTP_* -> PSR-18 HTTP Client
    ├── MailerHandler.php              # MAIL_* -> SMTP Mailer
    └── FilesystemHandler.php          # -> Filesystem Factory

```

11 source files. Adapters are optional — Foundation checks `class_exists()` at runtime.

### Package Layering

[](#package-layering)

```
jardissupport/contract       Interfaces (PSR + Jardis contracts)
        │
jardiscore/kernel            DDD Core (DomainApp, DomainKernel, BoundedContext, Response Pipeline)
        │
jardiscore/foundation        Integration Platform (JardisApp + ENV-driven Handlers)
        │
    ┌───┼───┬───────────┬───────────────┬──────────┬──────────┬────────────┐
    │       │           │               │          │          │            │
  cache  dbconnection  logger   eventdispatcher  http     mailer    filesystem
 (PSR-16)            (PSR-3)      (PSR-14)     (PSR-18)

```

---

The Jardis Ecosystem
--------------------

[](#the-jardis-ecosystem)

Foundation brings together these packages at runtime:

PackageRolePSR`jardiscore/kernel`DDD core: DomainApp, DomainKernel, BoundedContext, Response Pipeline—`jardissupport/contract`Shared interfaces across all packages—`jardisadapter/cache`Multi-layer caching (Memory, APCu, Redis, Database)PSR-16`jardisadapter/dbconnection`ConnectionPool with read/write splitting—`jardisadapter/logger`Log handlers (File, Console, Redis, Slack, Teams, Loki, Webhook)PSR-3`jardisadapter/eventdispatcher`Event dispatching with priority and type-hierarchy matchingPSR-14`jardisadapter/http`HTTP client with handler pipeline, retry, authPSR-18`jardisadapter/mailer`SMTP mailer with STARTTLS, AUTH, HTML/Text, attachments—`jardisadapter/filesystem`Local + S3 filesystem abstraction with unified API—All adapters are optional. Install what your project needs — Foundation detects availability at runtime.

---

Documentation
-------------

[](#documentation)

Full documentation, guides, and API reference:

**[docs.jardis.io/en/core/foundation](https://docs.jardis.io/en/core/foundation)**

---

License
-------

[](#license)

Licensed under the [MIT License](LICENSE.md).

---

**[Jardis](https://jardis.io)** · [Documentation](https://docs.jardis.io) · [Headgent](https://headgent.com)

KI-gestützte Entwicklung
------------------------

[](#ki-gestützte-entwicklung)

Dieses Package liefert einen Skill für Claude Code, Cursor, Continue und Aider mit. Installation im Konsumentenprojekt:

```
composer require --dev jardis/dev-skills
```

Mehr Details:

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance96

Actively maintained with recent releases

Popularity10

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

21d 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

foundationDomain Driven DesignddddomainHeadgentjardis

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[broadway/broadway

Infrastructure and testing helpers for creating CQRS and event sourced applications.

1.5k2.0M60](/packages/broadway-broadway)[broadway/broadway-bundle

Symfony bundle for broadway/broadway.

67864.7k7](/packages/broadway-broadway-bundle)[lunarstorm/laravel-ddd

A Laravel toolkit for Domain Driven Design patterns

18476.4k](/packages/lunarstorm-laravel-ddd)[nwidart/laravel-broadway

A Laravel adapter for the Broadway ES/CQRS package.

12315.0k](/packages/nwidart-laravel-broadway)

PHPackages © 2026

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