PHPackages                             ibanawx/prooph-event-store-rest-api-bundle - 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. [API Development](/categories/api)
4. /
5. ibanawx/prooph-event-store-rest-api-bundle

ActiveSymfony-bundle[API Development](/categories/api)

ibanawx/prooph-event-store-rest-api-bundle
==========================================

Make Prooph Event Store streams accessible over a REST API.

v1.0.0(9y ago)010MITPHPPHP ^7.0

Since Oct 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ibanawx/prooph-event-store-rest-api-bundle)[ Packagist](https://packagist.org/packages/ibanawx/prooph-event-store-rest-api-bundle)[ RSS](/packages/ibanawx-prooph-event-store-rest-api-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (11)Versions (2)Used By (0)

Installation
============

[](#installation)

1. Download
-----------

[](#1-download)

```
composer require ibanawx/prooph-event-store-rest-api-bundle

```

2. Bundle Registration
----------------------

[](#2-bundle-registration)

Register the following bundles in your Symfony kernel:

1. `Prooph\Bundle\EventStore\ProophEventStoreBundle`
2. `Ibanawx\Bundle\Prooph\EventStore\RestApiBundle\ProophEventStoreRestApiBundle`

3. Import Routes
----------------

[](#3-import-routes)

```
# app/config/routing.yml

prooph_event_store:
  resource: '@ProophEventStoreRestApiBundle/Resources/config/routing.yml'
  prefix: /event-store

```

The `prefix` option above is optional but useful if you'd like to separate this bundles routes from the other routes in your application.

Configuration
=============

[](#configuration)

```
# app/config/config.yml

prooph_event_store:
  stores:
    default:
      adapter: event_store_adapter_service_id

prooph_event_store_rest_api:
  event_store:
    name: default
  formatters:
    stream: ~
    event: ~

```

For more information on configuring the `prooph_event_store` bundle click [here](https://github.com/prooph/event-store-symfony-bundle).

`prooph_event_store_rest_api`

  Option Description Default   event\_store.name The name of the event store. Defined in the prooph\_event\_store config. No default   event\_store.formatters.stream Service ID of the stream formatter. prooph\_event\_store\_rest\_api.json\_stream\_formatter   event\_store.formatters.event Service ID of the stream event formatter. prooph\_event\_store\_rest\_api.json\_stream\_event\_formatter Usage
=====

[](#usage)

**All HTTP requests to the REST API must contain at least an `Accept` header specifying the content type you accept. The accepted content type is directly related to the output content type of the [formatter](#formatters).**

Getting a Stream
----------------

[](#getting-a-stream)

#### Request Placeholders:

[](#request-placeholders)

- `streamName`: The name of the stream.
- `minVersion`: The minimum event version that will appear in the stream.

  Request Response Info   GET /streams/{streamName}/{minVersion} 415 Unsupported Media Type If the 'Accept' header in the request is not the same as the output content type of the formatter. The 'Content-Type' of the response will be the content type that is supported by the server.   GET /streams/{streamName}/{minVersion} 404 Not Found If the stream does not exist.   GET /streams/{streamName}/{minVersion} 200 Ok The body of the response will contain the stream and its events. #### Succesful Response

[](#succesful-response)

By default, a response with an `application/json` content type will be returned. This is because the default [formatter](#formatters) formats the stream to JSON.

The default JSON formatter closely follows [The Atom Syndication Format](https://tools.ietf.org/html/rfc4287) but does not match it perfectly.

Let's say you have a `user` stream with 0 events. Sending a GET request to `http://site.com/streams/user/0` will respond with this:

```
{
  "id": "http://site.com/streams/user/0",
  "title": "user stream",
  "links": [],
  "entries": []
}

```

Let's say you have a `user` stream with **2** events. Sending a GET request to `http://site.com/streams/user/0` will respond with this:

```
{
  "id": "http://site.com/streams/user/0",
  "title": "user stream",
  "links": [
    {
      "uri": "http://site.com/streams/user/2",
      "relation": "next"
    }
  ],
  "entries": [
    {
      "id": "http://site.com/streams/user/events/0",
      "title": "0@user",
      "updated": "2016-10-25 21:41:03",
      "content": {
        "id": "44c552d3-0868-4e36-9b9b-160bad558d89",
        "name": "UserSignedUp",
        "version": 0,
        "metadata": {},
        "createdAt": "2016-10-25 21:41:03",
        "payload": {}
      }
    },
    {
      "id": "http://site.com/streams/user/events/1",
      "title": "1@user",
      "updated": "2016-10-25 21:43:56",
      "content": {
        "id": "e902f95f-60d0-4bc5-afcf-13eddc6eed23",
        "name": "UserSignedUp",
        "version": 1,
        "metadata": {},
        "createdAt": "2016-10-25 21:43:56",
        "payload": {}
      }
    }
  ]
}

```

### Stream Navigation

[](#stream-navigation)

The default JSON representation of a stream allows you to navigate through the stream using hypermedia links.

If the `user` stream contained 42 events (versions 0 - 41), sending a GET request to `http://site.com/streams/user/0` would respond with the following `next` link:

```
{
  "uri": "http://site.com/streams/user/42",
  "relation": "next"
}

```

To get the next event(s) in this stream you would poll the `next` URI.

**If the stream has no events from the minimum version you specified there will be no `next` link present in the stream.**

Getting a Stream Event
----------------------

[](#getting-a-stream-event)

#### Request Placeholders

[](#request-placeholders-1)

- `streamName`: The name of the stream.
- `version`: The version of the event.

  Request Response Info   GET /streams/{streamName}/events/{version} 415 Unsupported Media Type If the 'Accept' header in the request is not the same as the output content type of the formatter. The 'Content-Type' of the response will be the content type that is supported by the server.   GET /streams/{streamName}/events/{version} 404 Not Found If the stream or an event with the specified version does not exist.   GET /streams/{streamName}/events/{version} 200 Ok The body of the response will contain the stream event. Customization
=============

[](#customization)

Formatters
----------

[](#formatters)

A formatter takes a stream or an event and formats it into a string which is then sent back as the body of the response.

### Stream Formatter

[](#stream-formatter)

This formatter is called when [getting a stream](#getting-a-stream).

1. Implement `Ibanawx\Bundle\Prooph\EventStore\RestApiBundle\Formatter\StreamFormatter`
2. Define your custom formatter as a service in the dependency injection container.
3. Set the stream formatter to the service ID in your `app/config/config.yml` file.

#### Methods to Implement

[](#methods-to-implement)

- `getOutputContentType()`: Returns a string specifying the content type of the data which the formatter returns.
- `format()`: Returns a string representation of a stream.

### Stream Event Formatter

[](#stream-event-formatter)

This formatter is called when [getting a single stream event](#getting-a-stream-event).

1. Implement `Ibanawx\Bundle\Prooph\EventStore\RestApiBundle\Formatter\StreamEventFormatter`
2. Define your custom formatter as a service in the dependency injection container.
3. Set the stream event formatter to the service ID in your `app/config/config.yml` file.

#### Methods to Implement

[](#methods-to-implement-1)

- `getOutputContentType()`: Returns a string specifying the content type of the data which the formatter returns.
- `format()`: Returns a string representation of a stream event.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

3534d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/285662189?v=4)[stackoh](/maintainers/stackoh)[@stackoh](https://github.com/stackoh)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ibanawx-prooph-event-store-rest-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ibanawx-prooph-event-store-rest-api-bundle/health.svg)](https://phpackages.com/packages/ibanawx-prooph-event-store-rest-api-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)

PHPackages © 2026

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