jardiscore / foundation
DDD Foundation for PHP - Domain orchestration with zero-config infrastructure services
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/jardiscore/foundation
Requires
- php: >=8.2
- ext-amqp: *
- ext-apcu: *
- ext-json: *
- ext-pdo: *
- ext-rdkafka: *
- ext-redis: *
- jardisadapter/cache: ^1.0
- jardisadapter/dbconnection: ^1.0
- jardisadapter/logger: ^1.0
- jardisadapter/messaging: ^1.0
- jardisport/foundation: ^1.0
- jardissupport/classversion: ^1.0
- jardissupport/data: ^1.0
- jardissupport/dotenv: ^1.0
- jardissupport/factory: ^1.0
- jardissupport/repository: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.0.4
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^3.11.2
This package is auto-updated.
Last update: 2026-02-25 17:40:05 UTC
README
Part of the Jardis Ecosystem — A modular DDD framework for PHP
DDD Foundation for PHP. Domain orchestration with BoundedContext, Request/Response handling and zero-config infrastructure services for Database, Cache, Logger, and Messaging.
Features
- Domain Context — Base Domain class with automatic path detection and kernel bootstrapping
- Bounded Context — Request/Response handling with Factory integration and version-based class resolution
- Multi-Layer Caching — Memory → APCu → Redis → Database cascade
- Connection Pool — Connection pooling with read/write splitting via
ConnectionPoolInterface - Smart Logging — Conditional routing, sampling, fingers-crossed buffering, 20 handlers (File, Slack, Teams, Loki, Kafka, RabbitMQ, Email, Webhook, etc.)
- Flexible Messaging — Redis Streams, Kafka, RabbitMQ with priority-based selection
- SharedRuntime — Organization-wide infrastructure configuration as sibling directory, auto-detected
- Cross-Domain Connection Sharing — Multiple kernels automatically share connections
- Dynamic Class Versioning — Load different implementations by version at runtime via SubDirectory and Proxy loaders
Installation
composer require jardiscore/foundation
Quick Start
use JardisCore\Foundation\Domain; use JardisCore\Foundation\Context\BoundedContext; use JardisCore\Foundation\Context\Request; use JardisPort\Foundation\ResponseInterface; // Standard: ClassVersion with SubDirectory and Proxy loaders is active by default. class MyDomain extends Domain { public function myContext(Request $request): ResponseInterface { $context = new BoundedContext($this->getKernel(), $request); return $context->handle(MyBoundedContext::class); } } // Custom: Provide own ClassVersionConfig class EcommerceDomain extends Domain { protected function getClassVersion( ?ClassVersionConfigInterface $config = null, ): ?ClassVersionInterface { $config = new ClassVersionConfig( version: ['v1' => ['legacy'], 'v2' => ['current']], fallbacks: ['v2' => ['v1']] ); return parent::getClassVersion($config); } }
Infrastructure services via DomainKernel:
use JardisCore\Foundation\Adapter\DomainKernel; $kernel = new DomainKernel($appRoot, $domainRoot); $pool = $kernel->getConnectionPool(); // ConnectionPoolInterface $cache = $kernel->getCache(); // CacheInterface (PSR-16) $logger = $kernel->getLogger(); // LoggerInterface (PSR-3) $messaging = $kernel->getMessage(); // MessagingServiceInterface $factory = $kernel->getFactory(); // FactoryInterface
Domain-specific kernels via overridable createKernel():
class EcommerceDomain extends Domain { protected function createKernel( string $appRoot, string $domainRoot, ?ClassVersionInterface $classVersion, ResourceRegistryInterface $resources, ?string $sharedRuntimeRoot = null ): DomainKernelInterface { return new EcommerceKernel($appRoot, $domainRoot, $classVersion, $resources, $sharedRuntimeRoot); } }
SharedRuntime
Organization-wide infrastructure settings can be shared across domains via a SharedRuntime/ directory placed as a sibling of the domain root:
project/
├── SharedRuntime/ # Shared .env for all domains
│ └── .env
├── EcommerceDomain/
│ └── .env # Domain-specific overrides
└── UserDomain/
└── .env
The environment cascade loads in this order (later values override earlier):
AppRoot (public) → Foundation (private) → SharedRuntime (private) → Domain (private)
Domain auto-detects SharedRuntime/ as sibling of domainRoot. No configuration needed.
Documentation
Full documentation, examples and API reference:
→ jardis.io/docs/core/foundation
Jardis Ecosystem
This package is part of the Jardis Ecosystem — a collection of modular, high-quality PHP packages designed for Domain-Driven Design.
| Category | Packages |
|---|---|
| Core | Foundation |
| Adapter | Cache, Logger, Messaging, DbConnection |
| Support | DotEnv, DbQuery, Validation, Factory, ClassVersion, Workflow, Data, Repository |
| Tools | DomainBuilder, DbSchema |
License
This package is licensed under the PolyForm Noncommercial License 1.0.0.
For commercial use, see COMMERCIAL.md.