Skip to content

Commit 62dbb1e

Browse files
author
Codeliner
committed
Merge branch 'develop'
2 parents dc580b6 + dc8f866 commit 62dbb1e

22 files changed

+757
-64
lines changed

Vagrantfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
3636
end
3737

3838
config.vm.provision :docker
39-
config.vm.provision :docker_compose, compose_version: "1.5.1", yml: "/vagrant/docker-compose.yml", rebuild: false, run: "always"
40-
config.vm.provision "shell", inline: "cd /vagrant && docker-compose run --rm php sh bin/setup_composer.sh"
39+
config.vm.provision :docker_compose, yml: "/vagrant/docker-compose.yml", rebuild: false, run: "always"
40+
config.vm.provision "shell", inline: "cd /vagrant && docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 install -o --prefer-dist"
41+
config.vm.provision "shell", inline: "cd /vagrant && docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-doctrine-adapter -o --prefer-dist"
4142
config.vm.provision "shell", inline: "cd /vagrant && docker-compose run --rm php sh bin/setup_mysql.sh"
4243
end

bin/setup_composer.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

bin/setup_mongodb.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@ cd $DIR
66
echo "using adapter mongodb"
77
touch ./config/autoload/mongo_client.local.php
88

9-
php composer.phar require prooph/event-store-mongodb-adapter --update-no-dev -o --prefer-dist
10-
119
cat > config/autoload/mongo_client.local.php << EOL
1210
<?php
1311
return [
1412
'mongo_client' => function () {
1513
//Change set up of the mongo client, if you need to configure connection settings
16-
return new \MongoClient();
14+
return new \MongoClient('mongodb://mongodb:27017');
1715
},
1816
];
1917
EOL
2018

21-
cat > config/autoload/event_store.local.php << EOL
19+
cat > config/autoload/event_store.local.php << EOL
2220
<?php
2321
return [
2422
'prooph' => [

bin/setup_mysql.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ cd $DIR
66
echo "using adapter: mysql"
77
touch ./config/autoload/dbal_connection.local.php
88

9-
php composer.phar require prooph/event-store-doctrine-adapter --update-no-dev -o --prefer-dist
10-
119
cat > config/autoload/dbal_connection.local.php <<EOL
1210
<?php
1311
return [

config/autoload/dependencies.global.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
\Prooph\ProophessorDo\Model\Todo\Handler\MarkTodoAsDoneHandler::class => \Prooph\ProophessorDo\Container\Model\Todo\MarkTodoAsDoneHandlerFactory::class,
3434
\Prooph\ProophessorDo\Model\Todo\Handler\ReopenTodoHandler::class => \Prooph\ProophessorDo\Container\Model\Todo\ReopenTodoHandlerFactory::class,
3535
\Prooph\ProophessorDo\Model\Todo\Handler\AddDeadlineToTodoHandler::class => \Prooph\ProophessorDo\Container\Model\Todo\AddDeadlineToTodoHandlerFactory::class,
36+
\Prooph\ProophessorDo\Model\Todo\Handler\AddReminderToTodoHandler::class => \Prooph\ProophessorDo\Container\Model\Todo\AddReminderToTodoHandlerFactory::class,
3637
\Prooph\ProophessorDo\Model\Todo\TodoList::class => \Prooph\ProophessorDo\Container\Infrastructure\Repository\EventStoreTodoListFactory::class,
3738
// Projections
3839
\Prooph\ProophessorDo\Projection\User\UserProjector::class => \Prooph\ProophessorDo\Container\Projection\User\UserProjectorFactory::class,

config/autoload/prooph.global.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
\Prooph\ProophessorDo\Model\Todo\Command\MarkTodoAsDone::class => \Prooph\ProophessorDo\Model\Todo\Handler\MarkTodoAsDoneHandler::class,
5353
\Prooph\ProophessorDo\Model\Todo\Command\ReopenTodo::class => \Prooph\ProophessorDo\Model\Todo\Handler\ReopenTodoHandler::class,
5454
\Prooph\ProophessorDo\Model\Todo\Command\AddDeadlineToTodo::class => \Prooph\ProophessorDo\Model\Todo\Handler\AddDeadlineToTodoHandler::class,
55+
\Prooph\ProophessorDo\Model\Todo\Command\AddReminderToTodo::class => \Prooph\ProophessorDo\Model\Todo\Handler\AddReminderToTodoHandler::class,
5556
],
5657
],
5758
],
@@ -79,6 +80,9 @@
7980
\Prooph\ProophessorDo\Model\Todo\Event\DeadlineWasAddedToTodo::class => [
8081
\Prooph\ProophessorDo\Projection\Todo\TodoProjector::class,
8182
],
83+
\Prooph\ProophessorDo\Model\Todo\Event\ReminderWasAddedToTodo::class => [
84+
\Prooph\ProophessorDo\Projection\Todo\TodoProjector::class,
85+
],
8286
],
8387
],
8488
],

config/autoload/routes.global.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,19 @@
129129
],
130130
],
131131
],
132+
[
133+
'name' => 'command::add-reminder-to-todo',
134+
'path' => '/api/commands/add-reminder-to-todo',
135+
'middleware' => [
136+
\Prooph\ProophessorDo\Middleware\JsonPayload::class,
137+
\Prooph\Psr7Middleware\CommandMiddleware::class,
138+
],
139+
'allowed_methods' => ['POST'],
140+
'options' => [
141+
'values' => [
142+
\Prooph\Psr7Middleware\CommandMiddleware::NAME_ATTRIBUTE => \Prooph\ProophessorDo\Model\Todo\Command\AddReminderToTodo::class,
143+
],
144+
],
145+
],
132146
],
133147
];

docker-compose.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ nginx:
1111
- dataphp
1212

1313
php:
14-
image: prooph/php:5.6-fpm-xdebug
14+
image: prooph/php:5.6-fpm
1515
links:
1616
- mariadb:mariadb
17+
- mongodb:mongodb
1718
volumes_from:
1819
- dataphp
19-
environment:
20-
- ADAPTER=mysql
2120

2221
dataphp:
2322
image: debian:jessie
@@ -33,3 +32,8 @@ mariadb:
3332
- MYSQL_USER=dev
3433
- MYSQL_PASSWORD=dev
3534
- MYSQL_DATABASE=proophessor
35+
36+
mongodb:
37+
image: mongo
38+
ports:
39+
- 27017:27017

docs/installation.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,60 @@
11
# Installation
2-
proophessor-do offers you three options to install the demo application. We support Vagrant, Docker and have manual
2+
*proophessor-do* offers you three options to install the demo application. We support *Vagrant*, *Docker* and have *manual*
33
instructions.
44

5+
> Docker is the recommended and fastest installation method
6+
57
At first, please clone this repository by running `git clone https://github.com/prooph/proophessor-do.git` or download
6-
it manually from GitHub. If you use a own local web server, put this project to the document root of the local web
7-
server. Now navigate to the proophessor-do directory.
8+
it manually from GitHub.
9+
10+
If you use a own local web server, put this project to the document root of the local web
11+
server and navigate to the proophessor-do directory and follow the *Do it manually* instructions.
812

913
## Using Docker
10-
First ensure [Docker](https://docs.docker.com/engine/installation/ubuntulinux/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed. It's recommended to use the latest version of Docker and
11-
Docker Compose. Now install the dependencies and start the containers. Docker will now download all dependencies and
12-
starts the containers. This may take a while ...
14+
First ensure [Docker](https://docs.docker.com/engine/installation/ubuntulinux/) and [Docker Compose](https://docs.docker.com/compose/install/)
15+
are installed. It's recommended to use the latest version of Docker and Docker Compose. Docker will download all
16+
dependencies and starts the containers.
17+
18+
### Step 1 - Install dependencies
19+
20+
To ensure you have the latest Docker images for the default application execute:
21+
22+
```bash
23+
$ docker pull prooph/php:5.6-fpm && docker pull prooph/composer:5.6 && docker pull prooph/nginx:www
24+
```
25+
26+
Install PHP dependencies via Composer
27+
28+
```bash
29+
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 install -o --prefer-dist
30+
```
31+
32+
Now start your Docker Container so we can use Docker Compose for the next steps
1333

1434
```bash
15-
$ docker run --rm -it --volume $(pwd):/app composer/composer:master install --no-dev -o --prefer-dist --ignore-platform-reqs
1635
$ docker-compose up -d
1736
```
1837

19-
Call the MySQL setup script with:
38+
### Step 2 - Install event store adapter
39+
40+
*prooph* offers two database adapters for `prooph/event-store` (at the moment).
41+
42+
The read model uses MySQL so it's important to execute the MySQL setup. This configures also MySQL for the event store.
2043

2144
```bash
45+
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-doctrine-adapter -o --prefer-dist
2246
$ docker-compose run --rm php sh bin/setup_mysql.sh
2347
```
2448

25-
Now open [http://localhost:8080](http://localhost:8080/).
49+
If you want to use MongoDB (only PHP 5.6 supported) for the event store execute also:
50+
51+
```bash
52+
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-mongodb-adapter -o --prefer-dist
53+
$ docker-compose run --rm php sh bin/setup_mongodb.sh
54+
```
55+
56+
### Step 3 - That's it
57+
Now open [http://localhost:8080](http://localhost:8080/) and have fun.
2658

2759
## Using Vagrant
2860
Please install the following software if not already installed:
@@ -37,9 +69,12 @@ $: vagrant up
3769

3870
All dependencies will be downloaded. This may take a while ...
3971

40-
Now open [http://localhost:8080](http://localhost:8080/).
72+
Now open [http://localhost:8080](http://localhost:8080/) and have fun.
4173

4274
## Do it manually
75+
This is the hard way. Please ensure that you not want to use Docker. ;-)
76+
77+
### Step 1 - Get source code
4378

4479
`git clone https://github.com/prooph/proophessor-do.git` into the document root of a local web server.
4580

@@ -54,6 +89,8 @@ Pick the one you want to play with and install it via composer.
5489

5590
#### MongoDB Adapter
5691

92+
> Only PHP <= 5.6 is currently supported
93+
5794
`composer require prooph/event-store-mongodb-adapter`
5895

5996
### Step 3 - Configure Database
@@ -104,7 +141,7 @@ you should perform the [migrations](../migrations/) by running `php bin/migratio
104141
### Step 4 - View It
105142

106143
Open a terminal and navigate to the project root. Then start the PHP built-in web server with `php -S 0.0.0.0:8080 -t public`
107-
and open `http://localhost:8080/` in a browser.
144+
and open [http://localhost:8080](http://localhost:8080/) in a browser.
108145

109146
*Note: You can also set the environmental variable `PROOPH_ENV` to `development`. That will forward exception messages to the client in case of an error.
110147
When using the built-in web server you can set the variable like so: `PROOPH_ENV=development php -S 0.0.0.0:8080 -t public`*
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Prooph\ProophessorDo\Migrations;
4+
5+
use Doctrine\DBAL\Migrations\AbstractMigration;
6+
use Doctrine\DBAL\Schema\Schema;
7+
use Prooph\ProophessorDo\Projection\Table;
8+
9+
/**
10+
* Auto-generated Migration: Please modify to your needs!
11+
*/
12+
class Version20160304162921 extends AbstractMigration
13+
{
14+
15+
/**
16+
* @param Schema $schema
17+
*/
18+
public function up(Schema $schema)
19+
{
20+
$todo = $schema->getTable(Table::TODO);
21+
$todo->addColumn('reminder', 'string', ['default' => null, 'notnull' => false, 'length' => 30]);
22+
}
23+
24+
/**
25+
* @param Schema $schema
26+
*/
27+
public function down(Schema $schema)
28+
{
29+
$todo = $schema->getTable(Table::TODO);
30+
$todo->dropColumn('reminder');
31+
}
32+
}

0 commit comments

Comments
 (0)