Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Core Laravel Package

laravel-chronicle/core

Chronicle provides cryptographically verifiable audit logging for Laravel. It records events in an append-only, hash-chained ledger to make tampering detectable, with features like verifiable exports, signed checkpoints, key rotation, and external anchoring.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

Chronicle is a cryptographically verifiable audit logging solution designed for Laravel, addressing critical use cases like security logging, financial compliance, and forensic analysis. Its append-only ledger with hash chaining ensures tamper-proof audit trails, making it ideal for systems requiring immutable, verifiable records (e.g., regulatory compliance, fraud detection, or operational observability).

Key architectural strengths:

  • Immutable ledger: Prevents modification/deletion of past entries via cryptographic hashing.
  • Hash chaining: Each entry’s validity depends on the previous one, ensuring end-to-end integrity.
  • Signed checkpoints: Periodic cryptographic proofs of ledger state, enabling verifiable snapshots.
  • External anchoring: Optional integration with third-party append-only sinks (e.g., RFC 3161 timestamps, S3 Object Lock) to prevent database-level tampering.
  • Key rotation support: Securely transitions signing keys without breaking historical verifiability.

Fit for:High-assurance audit trails (e.g., financial systems, healthcare, legal compliance). ✅ Post-mortem forensics (e.g., security incidents, fraud investigations). ✅ Regulatory reporting (e.g., GDPR, SOX, PCI-DSS). ✅ Operational observability (e.g., tracking critical system changes).

Not ideal for:High-throughput, low-latency logging (hash chaining adds computational overhead per entry). ❌ Systems where audit logs are rarely queried (overkill for simple debugging logs). ❌ Environments without PHP 8.2+ or Laravel 12/13 (hard dependency on ext-sodium/ext-openssl).


Integration Feasibility

Chronicle integrates seamlessly into Laravel via:

  1. Eloquent Trait (HasChronicle) for automatic model auditing.
  2. Manual recording API for custom events.
  3. Artisan commands for management (e.g., chronicle:checkpoint, chronicle:verify).
  4. Query builder for filtering entries by actor, action, subject, or tags.

Database Schema:

  • Adds two tables (chronicle_entries, chronicle_checkpoints) with indexes for performance.
  • No schema migrations are required for existing apps (but chronicle:install handles setup).

Dependencies:

  • Hard: PHP 8.2+, Laravel 12/13, ext-sodium, ext-openssl.
  • Soft: Optional anchoring providers (e.g., AWS S3, RFC 3161 TSA).

Compatibility Risks:

  • Legacy Laravel: Requires Laravel 12/13 (no support for older versions).
  • Custom signing providers: May need adjustments for non-Ed25519/ECDSA setups (e.g., HSMs).
  • Database changes: If using non-MySQL/PostgreSQL, may need custom migrations for ULID/JSON fields.

Technical Risk

Risk Area Mitigation Strategy
Performance Overhead Benchmark hash chaining latency; consider batch recording for high-volume systems.
Key Management Use HSM/KMS (e.g., AWS KMS adapter) to avoid private keys in code.
External Anchoring Test TSA/S3 anchoring in staging; monitor failure rates.
Schema Changes Run chronicle:install --migrate in a staging environment first.
Verification Cost Use incremental verification (--since-last-checkpoint) for large ledgers.
ULID Generation Ensure clock synchronization (ULIDs require monotonic time).
Custom Providers Extend SigningProvider/AnchoringProvider interfaces for non-standard setups.

Critical Path Risks:

  1. Hash chain breaks: If an entry is accidentally modified (e.g., via raw SQL), the ledger becomes invalid until the next checkpoint.
  2. Key loss: Irrecoverable if the active private key is lost (backup private_key securely).
  3. Anchoring failures: If external sinks (e.g., TSA) are unavailable, checkpoints may fail to anchor.

Key Questions for TPM

  1. Compliance Requirements:

    • Does the system require externally verifiable audit trails (e.g., for regulators)?
    • Are signed checkpoints and external anchoring mandatory, or is internal verification sufficient?
  2. Performance Constraints:

    • What is the expected audit log volume (e.g., entries/sec)? Will hash chaining impact latency?
    • Can batch recording (e.g., queue workers) be used to reduce overhead?
  3. Key Management:

    • Who controls the signing keys? Will HSM/KMS (e.g., AWS KMS) be used, or will keys reside in the app?
    • What is the key rotation policy (e.g., monthly, per-deployment)?
  4. Operational Workflow:

    • How often will checkpoints be created? (Affects verification efficiency.)
    • Will automatic anchoring be enabled, or will it be manual?
  5. Disaster Recovery:

    • How will the ledger be restored after a database failure?
    • Are verifiable exports needed for backup/archival?
  6. Legacy Integration:

    • Are there existing audit logs that need to be migrated into Chronicle?
    • Will third-party systems need to query Chronicle directly?
  7. Cost Implications:

    • Will external anchoring (e.g., TSA, S3 Object Lock) incur additional costs?
    • Are there storage costs for ledger exports/checkpoints?

Integration Approach

Stack Fit

Chronicle is optimized for Laravel but can be adapted for PHP-based monoliths with minor adjustments. Key compatibility factors:

Component Fit Level Notes
Laravel 12/13 Native Full feature support (Eloquent, Facades, Artisan).
PHP 8.2+ Required Uses typed properties, attributes, and modern PHP features.
Eloquent Models Native HasChronicle trait integrates seamlessly.
Queue Workers Recommended Offloads hash chaining/computation for high-volume systems.
Custom PHP Apps Partial Requires manual setup of database migrations, signing keys, and event dispatching.
Microservices Limited Shared ledger requires consistent database access (not ideal for distributed writes).

Recommended Stack:

  • Laravel 13 (latest LTS).
  • PostgreSQL/MySQL (supports JSONB/ULID natively).
  • Redis (for queue-backed recording if needed).
  • AWS KMS/HSM (for secure key management).

Migration Path

Phase Steps Tools/Commands
Preparation 1. Assess compliance/audit requirements. Review docs, stakeholder alignment.
2. Benchmark performance with expected load. Load test with Chronicle::record().
3. Design key management strategy (HSM/KMS vs. local keys). chronicle:key:generate.
Installation 4. Add laravel-chronicle/core to composer.json. composer require.
5. Run php artisan chronicle:install --migrate. Migration setup.
6. Configure config/chronicle.php (keys, anchoring, retention). Manual edit.
Pilot 7. Enable HasChronicle on non-critical models first. Trait addition.
8. Test manual recording for custom events. Chronicle::record()->...->commit().
9. Verify ledger integrity with chronicle:verify. Artisan command.
Rollout 10. Gradually add HasChronicle to core models. Trait addition.
11. Set up automated checkpoints (e.g., cron job). php artisan chronicle:checkpoint.
12. Enable external anchoring (if required). Configure anchoring in config.
**Optimization
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky