Download the PHP package albertoarena/filament-event-sourcing without Composer

On this page you can find all versions of the php package albertoarena/filament-event-sourcing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-event-sourcing

Filament Event Sourcing

Filament Event Sourcing

Latest Version on Packagist Tests Total Downloads Repo views

Integrate spatie/laravel-event-sourcing with Filament admin panels.

Filament assumes Eloquent CRUD. Event sourcing routes writes through aggregates and reads through projections. This package bridges the two without hiding either side. It lets Filament resource pages persist through your aggregates, gives you a read-only audit trail of stored events, and adds a config-gated page to replay projectors. You always write the aggregate call; the package provides the plumbing.

This package does not generate aggregates, events or projectors, and it does not map form state to domain commands. Those remain your decisions.

Read the docs Demo app

Event history at a glance

Add the HasStoredEvents trait to a projection model and you can drop a full, read-only event history onto any record, either as a relation manager or as a slide-over action:

The action lists the aggregate's events in order, with the version, timestamp and an expandable JSON payload for each event.

Requirements

Installation

Register the plugin on your panel and opt in to the features you want:

Publish the config if you need to change the defaults:

Write bridge

The write bridge keeps Filament's full page lifecycle (form validation, mutate hooks, notifications and redirects) and replaces only the persistence step. You implement one method per operation; the package generates the uuid, resolves the resulting projection and reports errors.

The examples below use a Post aggregate with createPost, changeTitle and deletePost methods, recording PostCreated, PostTitleChanged and PostDeleted events, plus a synchronous PostProjector that maintains a Post projection model.

[!WARNING] Projectors must run synchronously for resources managed by Filament. The write bridge reads the projection back immediately after the aggregate persists, so a queued projector will not have created it yet and a ProjectionNotFoundException is thrown. Keep the projectors behind managed resources synchronous, or run the queue worker before the read.

Creating

The trait generates the uuid with Str::uuid(). Override newAggregateUuid() if you derive uuids differently.

Editing

Deleting

EventSourcedDeleteAction keeps the confirmation modal, notification and table refresh of Filament's DeleteAction, but never calls $record->delete() itself. Your projector owns the projection's lifecycle. Provide a ->using() closure that calls your aggregate:

If you forget the ->using() closure, the action throws a LogicException showing the snippet above.

Audit tooling

Stored Events browser

Enable storedEventsResource() on the plugin to add a read-only resource over Spatie's stored event model. It lists every stored event with its aggregate uuid, version, event class and timestamp, filters by event class, aggregate uuid and date range, and shows the full event payload as pretty-printed JSON. It never creates, edits or deletes events.

Per-record event history

Add the trait to your projection model:

The trait is primary-key agnostic. It links the aggregate uuid column (the aggregate_uuid_column config value, or a getAggregateUuidColumn() method on the model) to the stored events, so it works whether your projection uses a uuid primary key or an id primary key with a separate uuid column.

Then expose the history in either of two ways:

The history modal shows the latest 100 events with a notice when more exist.

Replay page

Enable replayPage() on the plugin to add a page that replays projectors one at a time. It is off by default and gated three ways: the plugin option, the replay.enabled config flag and an optional authorization ability. All three are checked again on the server before a replay runs.

[!WARNING] A replay runs synchronously inside the web request and can take a long time on large event stores. For production, prefer the CLI: php artisan event-sourcing:replay.

Replays must be safe to run. Spatie's replay does not wipe your read model: a full replay calls resetState() on each projector only if that method exists. Projectors behind Filament managed resources should be replay safe, either by implementing resetState() to clear their projection, or by making their handlers idempotent (for example with updateOrCreate). This package does not reset projections for you.

Adopting in an existing app

When you add this package to an app that already has data, new and existing records behave differently.

Records created through your aggregates after adoption are fully event sourced. Their events live in the stored events table, so they appear in the audit tooling and a projector replay rebuilds them.

Rows that already existed, created by ordinary Eloquent writes, have no events behind them. They keep working for reads, but they are not event sourced:

To bring existing rows into the model, backfill one initial event per row, a one-off command you write that records their current state, so the event store becomes the source of truth. This package does not perform that CRUD to event sourcing migration for you; it is a domain decision that only you can make.

Configuration

Testing

Changelog

See CHANGELOG.md for recent changes.

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md for reporting vulnerabilities.

Related packages

License

The MIT License (MIT). See LICENSE.md.


All versions of filament-event-sourcing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0
filament/filament Version ^4.0
spatie/laravel-event-sourcing Version ^7.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package albertoarena/filament-event-sourcing contains the following files

Loading the files please wait ...