PHPackages                             maatify/event-logging - 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. [Database &amp; ORM](/categories/database)
4. /
5. maatify/event-logging

ActiveLibrary[Database &amp; ORM](/categories/database)

maatify/event-logging
=====================

Framework-agnostic standalone event logging library containing isolated Maatify logging domains. Depends only on explicit Composer/runtime dependencies.

v1.0.0(1mo ago)1234↓43.8%MITPHPPHP ^8.2CI passing

Since Jul 9Pushed 4w agoCompare

[ Source](https://github.com/Maatify/event-logging)[ Packagist](https://packagist.org/packages/maatify/event-logging)[ Docs](https://github.com/Maatify/event-logging)[ RSS](/packages/maatify-event-logging/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (5)Used By (0)

Maatify Event Logging
=====================

[](#maatify-event-logging)

[![Maatify.dev](https://camo.githubusercontent.com/bb8bf9ee079d7f823c9d5e94061d1d4c11dc0898e2b1b5cc9a8a7b04d8bfdd7d/68747470733a2f2f7777772e6d6161746966792e6465762f6173736574732f696d672f696d672f6d6161746966795f6c6f676f5f77686974652e737667)](https://camo.githubusercontent.com/bb8bf9ee079d7f823c9d5e94061d1d4c11dc0898e2b1b5cc9a8a7b04d8bfdd7d/68747470733a2f2f7777772e6d6161746966792e6465762f6173736574732f696d672f696d672f6d6161746966795f6c6f676f5f77686974652e737667)

[![Latest Version](https://camo.githubusercontent.com/51aae8716568d9aa324718729a4a3b53306fbef50f8b41616b58d647620a0b77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6161746966792f6576656e742d6c6f6767696e672e737667)](https://packagist.org/packages/maatify/event-logging)[![PHP Version](https://camo.githubusercontent.com/4ec4ad09df12ada97fe9c0930bba752527cdd123772bc1e30c9428d165f1d226/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6161746966792f6576656e742d6c6f6767696e672e737667)](https://packagist.org/packages/maatify/event-logging)[![License](https://camo.githubusercontent.com/56669dbc8ea697f3d3bd7ea975292090a8275f387ef9964cdf8a88b2fa38a829/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6161746966792f6576656e742d6c6f6767696e672e737667)](LICENSE)[![PHPStan](https://camo.githubusercontent.com/f85016b73718ab38275b913dafed1c1ce7f287c3c2ec319445bc29011149f408/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c2532304d61782d344538434145)](https://github.com/Maatify/event-logging)

[![Monthly Downloads](https://camo.githubusercontent.com/ef8f26d535bd1c141a3409114f2def0aaa70a53095cc5a64253e392baac33e3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6161746966792f6576656e742d6c6f6767696e67)](https://packagist.org/packages/maatify/event-logging)[![Total Downloads](https://camo.githubusercontent.com/8d10ab8ffa9d1af9df2df9ce8cd089e02e36addb6769271af60abbc153ab8c0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6161746966792f6576656e742d6c6f6767696e67)](https://packagist.org/packages/maatify/event-logging)[![Maatify Ecosystem](https://camo.githubusercontent.com/e909123cad12b048a0b4441f2b9cfb19aebfb3986afe8e3631da84255281c12d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6161746966792d45636f73797374656d2d626c756576696f6c6574)](https://github.com/Maatify)[![Install](https://camo.githubusercontent.com/28abad6528eff177c6bbae839e4db652ce70fb40dd4a39886f09e5c257f2d532/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f496e7374616c6c2d636f6d706f736572253230726571756972652532306d6161746966792532466576656e742d2d6c6f6767696e672d626c7565)](https://packagist.org/packages/maatify/event-logging)

[![Changelog](https://camo.githubusercontent.com/823f0865f88efc23894c06d92d2a141ebe8385c761b2ae1e34a40b958159a653/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4368616e67656c6f672d566965772d626c75652e737667)](CHANGELOG.md)[![Package Reference](https://camo.githubusercontent.com/e4a13cadb130f9f0f5af5f24632e95e70013a033eb76328d060ac907f8b7e05c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5265666572656e63652d526561642d626c75652e737667)](EVENT_LOGGING_PACKAGE_REFERENCE.md)[![Security Policy](https://camo.githubusercontent.com/3b9feb2066dbbe942adeafa8ed9d61c3763721f32609f314240571ed1c4e8862/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53656375726974792d506f6c6963792d626c75652e737667)](SECURITY.md)[![Contributing Guide](https://camo.githubusercontent.com/796cd1ae773d0577e7bd35df43a8b8eff55755f8925a6f1f7b3c006817e3a186/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e747269627574696e672d47756964652d626c75652e737667)](CONTRIBUTING.md)

`maatify/event-logging` is a framework-agnostic standalone Composer package for registering event logging domains within the Maatify ecosystem.

This package provides strict domain isolation, MySQL persistence, and fail-open/fail-closed semantics without mandatory framework bindings. It intentionally relies on explicit Composer and runtime dependencies to operate autonomously from host applications and frameworks.

---

🚀 Key Features
--------------

[](#-key-features)

- **Six Isolated Logging Domains**: Explicit boundaries for audit, tracing, signals, and operations.
- **Domain-Specific Recorders**: Tailored commands, DTOs, and repositories per domain.
- **MySQL-Only Persistence**: Direct database persistence through domain-owned repositories.
- **AuthoritativeAudit Semantics**: Fail-closed governance logging.
- **Fail-Open Boundaries**: Non-authoritative domains can accept a PSR-3 fallback logger.
- **Optional Framework-Agnostic Provider and Bindings**: Built-in optional factories and pure-PHP DI binding helpers for wiring dependencies.
- **Primitive Cursor-Based Read APIs**: Dedicated, stable read/query capabilities.
- **No Mandatory Framework Bindings**: Optional bindings are pure PHP convenience helpers and do not add framework runtime dependencies.
- **No Generic Logging API**: Excludes shared generic loggers, generic log tables, or unified repositories.

---

📋 Requirements
--------------

[](#-requirements)

- PHP `^8.2`
- `ext-json`
- `ext-pdo`

**Composer/Runtime Dependencies:**

- `psr/log`
- `ramsey/uuid`
- `maatify/exceptions`
- `maatify/shared-common`

---

📦 Installation
--------------

[](#-installation)

```
composer require maatify/event-logging
```

---

📖 Usage
-------

[](#-usage)

### Factory / Provider Wiring

[](#factory--provider-wiring)

Host applications provide their own dependencies (PDO, Clock, PSR-3 Logger) to instantiate the domain provider:

```
use Maatify\EventLogging\Provider\EventLoggingProviderFactory;
use Maatify\EventLogging\Common\SystemClock;

$pdo = new \PDO('mysql:host=localhost;dbname=mydb', 'user', 'pass');
$clock = new SystemClock();
$psrLogger = new \Monolog\Logger('event-logging-fallback'); // Optional for fail-open domains

// Create the provider service map
$provider = EventLoggingProviderFactory::createDefault($pdo, $clock, $psrLogger);

// Typed accessors enforce strict domain API boundaries
$auditTrail = $provider->auditTrail();
```

*(See [`01-factory-provider.php`](examples/01-factory-provider.php) for manual factory/provider wiring. Hosts that prefer DI can also import the optional pure-PHP `Maatify\EventLogging\Bootstrap\EventLoggingBindings::definitions()` helper; this helper is not required and does not introduce framework-specific behavior.)*

### Domain Recorder Usage

[](#domain-recorder-usage)

Recording an authoritative audit (fail-closed, requires robust persistence):

```
$authoritativeAudit = $provider->authoritativeAudit();

// Using the primitive convenience record method
$authoritativeAudit->record(
    action: 'update_permissions',
    targetType: 'user',
    targetId: 123,
    riskLevel: 'HIGH',
    actorType: 'admin',
    actorId: 1,
    payload: ['role' => 'superuser'],
    correlationId: 'abc-123'
);
```

*(See [`03-authoritative-audit-record.php`](examples/03-authoritative-audit-record.php) and [`04-audit-trail-record.php`](examples/04-audit-trail-record.php) for broader examples.)*

---

🏗️ Logging Domains
------------------

[](#️-logging-domains)

The package maintains six separated event domains:

1. **AuthoritativeAudit** — Governance/security posture logging with fail-closed semantics.
2. **AuditTrail** — Reads, views, exports, and navigation visibility events.
3. **SecuritySignals** — Authentication and security anomaly signals.
4. **BehaviorTrace** — Operational activity and mutation-only behavior events.
5. **DiagnosticsTelemetry** — Technical observability and diagnostic events.
6. **DeliveryOperations** — Async jobs, notifications, webhooks, and delivery lifecycle events.

---

🛡️ Architecture Guarantees
--------------------------

[](#️-architecture-guarantees)

- **Framework-Agnostic**: Operates without any dependency on external framework containers or routes.
- **Standalone Execution**: Complete isolation from host application codebases.
- **Domain Isolation**: Every logging domain has exclusive ownership over its DTOs, tables, and policies.
- **Host-Provided PDO**: Database connections must be injected; the package does not manage connection lifecycles.
- **MySQL-Only**: Relies purely on MySQL schema without SQLite fallback support.
- **Explicit Dependencies Only**: Avoids zero-dependency assumptions; explicit runtime requirements ensure robustness.
- **No Generic Paradigms**: The package does not expose a catch-all logger, generic recorder, generic repository, or shared generic log table. PSR-3 is used only as an optional fallback logger for fail-open domains.

---

🧪 Examples
----------

[](#-examples)

The `examples/` directory contains plain PHP illustrative skeletons covering integration scenarios. See the [Examples Coverage Plan](docs/examples/EXAMPLES_COVERAGE_PLAN.md) for full context.

- [`01-factory-provider.php`](examples/01-factory-provider.php)
- [`02-manual-wiring.php`](examples/02-manual-wiring.php)
- [`03-authoritative-audit-record.php`](examples/03-authoritative-audit-record.php)
- [`09-admin-read-audit-trail.php`](examples/09-admin-read-audit-trail.php)
- [`11-cursor-pagination.php`](examples/11-cursor-pagination.php)
- [`13-psr-fallback-logger.php`](examples/13-psr-fallback-logger.php)

---

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

[](#-documentation)

- [Event Logging Package Reference](EVENT_LOGGING_PACKAGE_REFERENCE.md)
- [Schema Layout](schema/README.md)
- [Testing Strategy](TESTING_STRATEGY.md)

### Architecture

[](#architecture)

- [Unified Logging Architecture](docs/architecture/LOGGING_ARCHITECTURE.md)
- [Logging Domain Rules](docs/architecture/LOGGING_DOMAIN_RULES.md)
- [CI Workflow Standard](docs/standards/CI_WORKFLOW_STANDARD.md)
- [Storage &amp; Schema Guarantees](docs/architecture/STORAGE_AND_SCHEMA.md)
- [Deferred Scope &amp; Future Considerations](docs/architecture/DEFERRED_SCOPE.md)
- [Authoritative Audit Pipeline](docs/architecture/AUTHORITATIVE_AUDIT_PIPELINE.md)
- [Admin Query API Roadmap](docs/roadmap/ADMIN_QUERY_API_ROADMAP.md)

### Integration Guides

[](#integration-guides)

- [Installation Guide](docs/integration/INSTALLATION.md)
- [Factory Usage](docs/integration/FACTORY_USAGE.md)
- [Manual Wiring](docs/integration/MANUAL_WIRING.md)
- [DI Bindings](docs/integration/DI_BINDINGS.md)
- [Admin Read Usage](docs/integration/ADMIN_READ_USAGE.md)

---

✅ Quality Status
----------------

[](#-quality-status)

- PHP 8.2+
- PHPStan Level Max
- PHPUnit testing available
- GitHub Actions CI validated

---

🪪 License
---------

[](#-license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

👤 Author
--------

[](#-author)

Engineered by **Mohamed Abdulalim** ([@megyptm](https://github.com/megyptm))
Backend Lead &amp; Technical Architect

---

[Built with ❤️ by Maatify.dev — Unified Ecosystem for Modern PHP Libraries](https://www.maatify.dev)

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance92

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50.4% 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

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a885a0810f2762586520ab284c9019aaf0b650b53cdf2a6c13ea10931bb7795?d=identicon)[Maatify](/maintainers/Maatify)

---

Top Contributors

[![Maatify](https://avatars.githubusercontent.com/u/130119162?v=4)](https://github.com/Maatify "Maatify (174 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (134 commits)")[![megyptm](https://avatars.githubusercontent.com/u/33574895?v=4)](https://github.com/megyptm "megyptm (37 commits)")

---

Tags

auditaudit-trailbehavior-tracecomposerdelivery-operationsdiagnostics-telemetryevent-loggingframework-agnosticlibraryloggingmaatifymaatify-devmaatify-ecosystemmysqlpdophpsecurity-signalsloggingmysqlpdoAuditaudit-trailevent loggingsecurity-signalsbehavior-tracediagnostics-telemetrydelivery-operations

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/maatify-event-logging/health.svg)

```
[![Health](https://phpackages.com/badges/maatify-event-logging/health.svg)](https://phpackages.com/packages/maatify-event-logging)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.6k](/packages/laravel-framework)[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k614.3M7.4k](/packages/doctrine-dbal)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M780](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

11.3k4.0k](/packages/leantime-leantime)[laravel/nightwatch

The official Laravel Nightwatch package.

37111.6M46](/packages/laravel-nightwatch)

PHPackages © 2026

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