diff --git a/README.md b/README.md
index 958b6851..4b0c05c7 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
- [Install Laravel from a Docker Container](#Install-Laravel)
- [Run Artisan Commands](#Run-Artisan-Commands)
- [Use Redis](#Use-Redis)
+ - [Use Mongo](#Use-Mongo)
- [PHP](#PHP)
- [Install PHP Extensions](#Install-PHP-Extensions)
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
@@ -92,6 +93,7 @@ docker-compose up nginx mysql redis
- PostgreSQL
- MariaDB
- Neo4j
+- MongoDB
- Redis
- Memcached
- Beanstalkd
@@ -208,7 +210,7 @@ docker-compose up -d nginx mysql
*Note: the PHP-FPM, Workspace, Application and Data Containers will automatically run.*
-Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`.
+Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`.
@@ -512,9 +514,6 @@ Composer update
```bash
phpunit
```
-```bash
-laravel new blog
-```
@@ -527,7 +526,11 @@ laravel new blog
### Use Redis
-1 - First make sure you run the Redis Container with the `docker-compose` command.
+1 - First make sure you run the Redis Container (`redis`) with the `docker-compose up` command.
+
+```bash
+docker-compose up -d redis
+```
2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1` IP.
@@ -555,7 +558,7 @@ CACHE_DRIVER=redis
SESSION_DRIVER=redis
```
-4 - Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer first.
+4 - Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer:
```bash
composer require predis/predis:^1.0
@@ -571,6 +574,59 @@ composer require predis/predis:^1.0
+
+
+### Use Mongo
+
+1 - First make sure you run the MongoDB Container (`mongo`) with the `docker-compose up` command.
+
+```bash
+docker-compose up -d mongo
+```
+
+
+2 - Add the MongoDB configurations to the `config/database.php` config file:
+
+```php
+'connections' => [
+
+ 'mongodb' => [
+ 'driver' => 'mongodb',
+ 'host' => env('DB_HOST', 'localhost'),
+ 'port' => env('DB_PORT', 27017),
+ 'database' => env('DB_DATABASE', 'database'),
+ 'username' => '',
+ 'password' => '',
+ 'options' => [
+ 'database' => '',
+ ]
+ ],
+
+ // ...
+
+],
+```
+
+3 - Open your Laravel's `.env` file and update the following variables:
+
+- set the `DB_HOST` to your `Docker-IP`.
+- set the `DB_PORT` to `27017`.
+- set the `DB_DATABASE` to `database`.
+
+
+4 - Finally make sure you have the `jenssegers/mongodb` package installed via Composer and its Service Provider is added.
+
+```bash
+composer require jenssegers/mongodb
+```
+More details about this [here](https://github.com/jenssegers/laravel-mongodb#installation).
+
+5 - Test it:
+
+- First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent).
+- Enter the Workspace Continer `docker exec -it laradock_workspace_1 bash`.
+- Migrate the Database `php artisan migrate`.
+
diff --git a/docker-compose.yml b/docker-compose.yml
index 350a8ebe..06262604 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -31,8 +31,9 @@ services:
- /var/lib/postgres:/var/lib/postgres
- /var/lib/mariadb:/var/lib/mariadb
- /var/lib/memcached:/var/lib/memcached
- - /var/lib/neo4j:/var/lib/neo4j/data
- /var/lib/redis:/data
+ - /var/lib/neo4j:/var/lib/neo4j/data
+ - /var/lib/mongo:/data/db
### Nginx Server Container ##################################
@@ -101,6 +102,15 @@ services:
volumes_from:
- data
+### MongoDB Container #######################################
+
+ mongo:
+ build: ./mongo
+ ports:
+ - "27017:27017"
+ volumes_from:
+ - data
+
### Redis Container #########################################
redis:
diff --git a/mongo/Dockerfile b/mongo/Dockerfile
new file mode 100644
index 00000000..897e6f06
--- /dev/null
+++ b/mongo/Dockerfile
@@ -0,0 +1,12 @@
+FROM mongo:latest
+
+MAINTAINER Mahmoud Zalt
+
+#COPY mongo.conf /usr/local/etc/mongo/mongo.conf
+
+VOLUME /data/db /data/configdb
+
+CMD ["mongod"]
+
+EXPOSE 27017
+
diff --git a/php-fpm/Dockerfile-55 b/php-fpm/Dockerfile-55
index 9d8af111..ec970ef5 100644
--- a/php-fpm/Dockerfile-55
+++ b/php-fpm/Dockerfile-55
@@ -25,6 +25,9 @@ RUN pecl install memcached \
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
+# Install mongodb driver
+RUN pecl install mongodb
+
RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel
diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56
index cea383ac..e86564de 100644
--- a/php-fpm/Dockerfile-56
+++ b/php-fpm/Dockerfile-56
@@ -25,6 +25,9 @@ RUN pecl install memcached \
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
+# Install mongodb driver
+RUN pecl install mongodb
+
RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel
diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70
index 01dfb2c9..d6179474 100644
--- a/php-fpm/Dockerfile-70
+++ b/php-fpm/Dockerfile-70
@@ -29,6 +29,9 @@ RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-m
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
+# Install mongodb driver
+RUN pecl install mongodb
+
RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel
diff --git a/php-fpm/laravel.ini b/php-fpm/laravel.ini
index ada3a5de..b31c55b7 100644
--- a/php-fpm/laravel.ini
+++ b/php-fpm/laravel.ini
@@ -1,3 +1,4 @@
date.timezone=UTC
display_errors=Off
-log_errors=On
\ No newline at end of file
+log_errors=On
+extension=mongodb.so
diff --git a/workspace/Dockerfile b/workspace/Dockerfile
index 23403bb2..be17d963 100644
--- a/workspace/Dockerfile
+++ b/workspace/Dockerfile
@@ -34,6 +34,12 @@ RUN apt-get update && apt-get install -y --force-yes \
php7.0-sqlite3 \
php7.0-zip \
php7.0-memcached \
+ php-dev \
+ libcurl4-openssl-dev \
+ libedit-dev \
+ libssl-dev \
+ libxml2-dev \
+ xz-utils \
sqlite3 \
libsqlite3-dev \
git \
@@ -66,6 +72,10 @@ RUN curl -s http://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/ \
&& echo "alias composer='/usr/local/bin/composer.phar'" >> ~/.bashrc
+# Install mongodb extension
+RUN pecl install mongodb
+RUN echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini
+
# Source the bash
RUN . ~/.bashrc