Download the PHP package digitalrisks/lese without Composer

On this page you can find all versions of the php package digitalrisks/lese. 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 lese

Laravel Event Sourcing and Eventstore (lese) Bridge

Or German for read which is somewhat applicable to Event Sourcing. It's almost a good name.

This package swaps out the Event and Snapshot storage model for Laravel Event Souring with EventStore. EventStore has a few advantages over a database in that it is purpose built for event sourcing.

The package also includes a subscribe command so that you may listen to events origination from other services in your system.

Installation

First of all let's bring in the package and Laravel Event Sourcing into our Laravel app.

Then publish the Laravel Event Sourcing and Lese configuration files.

Then jump into config/event-sourcing.php to configure EventStore as our event and snapshot storage repositories.

Configuration

This is the default content of the config file that will be published at config/lese.php

Getting Started

I would recommend getting familiar with Event Sourcing by reading through the excellent guide at https://docs.spatie.be/laravel-event-sourcing/v3/introduction/.

The next step is to get a local version of the EventStore running (you won't need a database). There are instructions for every platform at https://eventstore.com/docs/getting-started/index.html

Let's now create a simple event:

And fire it off:

Let's create a simple Projection to put account information in a database.

And also send an event to the FBI for large transactions:

If, later on, the business wants to have an attribute on the model for number_of_deposits, we update the Projector:

And re-run the events:

Learn more how to use Event Sourcing by following the guides at https://docs.spatie.be/laravel-event-sourcing/v3/introduction/

Aggregates

If you're not using aggregates, you can skip this section.

In order for the EventStore repositories to fetch the events and/or snapshots related to an aggregate, it needs to know about the aggregate. To do this we simply override the two methods below to initiate the repostiory and pass in the aggregate.

Subscribing to Streams

The package also includes a long-running process, similar to Pub / Sub with php artisan redis:subscribe whereby you can listen to events from a stream.

Let's say this is the the accounts-service but we wanted listen for events from the quotes-service. When a quote is converted, we want to create an account for it.

Careful: If you listen to events that you publish, projectors and reactors will process them once in your application and again when they come back down the stream. It's recommended you subscribe only to streams that you don't publish to.

In config/lese.php we would add the stream for quote converted events:

We could then run the following command to create the persistent subscriptions on EventStore

Careful: When resetting persistent subscriptions, it will start from the first event again. If you have reactors, you should go into the eventstore admin and set the start from value to the event number you want to start from.

And finally start the subscribe process

Event Metadata

Metadata can help trace events around your system. You can include any of the following traits on your event to attach metadata automatically

Or you can define your own methods to collect metadata. Any method with the @metadata annotation will be called:

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of lese with dependencies

PHP Build Version
Package Version
Requires spatie/laravel-event-sourcing Version ^3.1
prooph/event-store-http-client Version ^1.0@beta
php-http/guzzle6-adapter Version ^2.0
prooph/event-store-client Version ^1.0@RC
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 digitalrisks/lese contains the following files

Loading the files please wait ....