Code Monkey home page Code Monkey logo

broadway-demo's Introduction

Demo for Broadway - EventSourcing library for PHP

This repository contains a demo application to show how Broadway can be used within a Symfony application. The example is taken from the Practical Event Sourcing talk from Mathias Verraes.

Installation

vagrant up

Vagrant will provision the machine (using ansible).

The box is then available at 192.168.42.100, the vhost is configured with domain broadway.local.

If you don't have ansible installed, you will have to run composer install yourself. And run app/console broadway:event-store:schema:init to initialize the database.

Running the demo

This demo doesn't have a GUI, only an API with the following endpoints:

Method Path Description
POST /basket Pickup a new basket, returns the basketId
POST /basket/{basketId}/addProduct Add a product to a basket (productId and productName should be given as form fields)
POST /basket/{basketId}/removeProduct Remove a product from a basket (productId as form field)
POST /basket/{basketId}/checkout Checkout a basket
GET /advice/{productId} Retrieve Other people also bought this list

Running the tests

Login to your vagrant box to run the tests. By default we exclude functional tests, by providing --exclude-group=none you can run the functional tests as well.

cd /vagrant
phpunit --exclude-group=none

Code structure

  • Domain code can be found in src/BroadwayDemo/Basket
  • ReadModel code can be found in src/BroadwayDemo/ReadModel
  • Controller / services can be found in src/BroadwayDemoBundle

Note that there are two files for the services: services.xml and domain.xml. domain.xml contains all the domain-specific services (CommandHandler, ReadModels, Repositories), while services.xml contains domain-unspecific services (controllers etc).

The domain specific tests can be found in test/BroadwayDemo/Basket and test/BroadwayDemo/ReadModel

Note that there is a functional test (using ElasticSearch) in test/BroadwayDemoBundle/Functional

For more information, read our blog post about this demo: http://labs.qandidate.com/blog/2014/12/30/a-broadway-demo-application/

broadway-demo's People

Contributors

cordoval avatar fritsjanb avatar luismulinari avatar markredeman avatar ruudk avatar wjzijderveld avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.