maatify/shared-common

Fundamental contracts and shared abstractions for Maatify modules, including clock and telemetry interfaces.

Maintainers

Package info

github.com/Maatify/SharedCommon

Issues

pkg:composer/maatify/shared-common

Statistics

Installs: 61

Dependents: 1

Suggesters: 0

Stars: 0

v1.0.0 2026-03-11 02:56 UTC

This package is auto-updated.

Last update: 2026-03-11 02:57:05 UTC


README

Latest Version PHP Version License

PHPStan

Changelog Security

Monthly Downloads Total Downloads

Maatify Ecosystem

Install

Overview

The Maatify\SharedCommon module contains foundational contracts and abstractions that are intended to be shared across all Maatify modules (such as AdminKernel, Verification, etc.). Its primary goal is to provide unified interfaces for common cross-cutting concerns like time management, security contexts, and telemetry, enabling consistent behavior and testing across the entire system.

Purpose

By depending on SharedCommon rather than framework-specific implementations or raw PHP functions (like time() or date()), other modules can remain truly framework-agnostic. This module defines the "how we communicate" contracts for basic system realities.

Module Structure

Modules/SharedCommon/
├── Bootstrap/                 # Dependency Injection bindings
│   └── SharedCommonBindings.php
├── Contracts/                 # Core interfaces for time, telemetry, and security
│   ├── ClockInterface.php
│   ├── SecurityEventContextInterface.php
│   └── TelemetryContextInterface.php
├── Infrastructure/            # Default implementations of contracts
│   └── SystemClock.php
├── docs/                      # Architectural and integration documentation
└── composer.json              # Standalone package metadata

Quick Usage

To quickly integrate the default implementations of this module into your dependency injection container:

use Maatify\SharedCommon\Bootstrap\SharedCommonBindings;
use DI\ContainerBuilder;
use Maatify\SharedCommon\Contracts\ClockInterface;

$builder = new ContainerBuilder();

// Register the bindings for SharedCommon contracts
SharedCommonBindings::register($builder);

$container = $builder->build();

// Resolve the Clock
/** @var ClockInterface $clock */
$clock = $container->get(ClockInterface::class);

// Get the current time as a DateTimeImmutable object
$now = $clock->now();
echo $now->format('Y-m-d H:i:s');

Further Documentation

  • How to Use - Practical integration instructions.
  • Changelog - History and evolution of the module.

Documentation Book

Comprehensive architecture and integration guides are available in the Book:

Chapter Description
Table of Contents Main entry point for the documentation book.
01. Overview The philosophy and purpose behind SharedCommon.
02. Architecture Layering and separation of interfaces and infrastructure.
03. Domain Objects Core contracts representing the system state context.
04. Clock Abstraction Why the ClockInterface is crucial for testability and consistency.
05. Integration Patterns Real-world DI container wiring and cross-module usage.
06. Extension Points How to provide application-specific context implementations.