Services

Tip

For every service, the host is the name of the service, and the port is the default one. For example, for mysql, host is mysql and port is 3306.

Tip

To open a connection to a service using a GUI, you can use SSH tunnelling (manually, or within you favorite GUI - example for MySQL Workbench here).

Memcached

Configuration options:

# .devflow.yml
stack:
  memcached:
    version: 1.4     # (Required) Possible versions: 1.4

Sample code:

<?php
$memcached = new Memcached;
$memcached->addServer('memcache',11211);

Mongo

Configuration options:

# .devflow.yml
stack:
  mongo:
    version: 3.4     # (Required) Possible versions: 3.0, 3.2, 3.4

Sample code:

<?php
# http://php.net/manual/en/mongodb.tutorial.library.php
require 'vendor/autoload.php'; // after a "composer require mongodb/mongodb"
$client = new MongoDB\Client("mongodb://mongo:27017");
$collection = $client->demo->beers;
$result = $collection->insertOne( [ 'name' => 'Hinterland', 'brewery' => 'BrewDog' ] );

MySQL

Configuration options:

# .devflow.yml
stack:
  mysql:
    version: 8.0     # (Required) Possible versions: 8.0, 5.7, 5.6, 5.5
    user: devflow    # (Required)
    password: 123    # (Required)
    databases:       # (At least one required)
      - my_db
    config:          # (Optional)
      - max_allowed_packet=256M

Sample code:

<?php
$dbh = new PDO('mysql:host=mysql;dbname=my_db', 'devflow', '123');

PostgreSQL

Configuration options:

# .devflow.yml
stack:
  postgres:
    version: 9.6     # (Required) Possible versions: 9.6, 9.5, 9.4, 9.3, 9.2
    user: devflow    # (Required)
    password: 123    # (Required)
    databases:       # (At least one required)
      - my_db

Sample code:

<?php
$dbh = new PDO('pgsql:host=postgres;port=5432;dbname=my_db', 'devflow', '123');

RabbitMQ

Configuration options:

# .devflow.yml
stack:
  rabbitmq:
    version: 3.6    # (Required) Possible versions: 3.6
    rabbitmqctl:    # A list of rabbitmqctl actions to provision the service
      - add_user devflow 123
      - add_vhost devflow.dev
      - set_permissions -p devflow.dev devflow .\* .\* .\*

Sample code:

<?php
$connection = new AMQPConnection();  
$connection->setHost('rabbitmq');
$connection->setLogin('devflow');
$connection->setPassword('123');
$connection->connect();

Redis

Configuration options:

# .devflow.yml
stack:
  redis:
    version: 3.2    # (Required) Possible versions: 3.2, 3.0

Sample code:

<?php
$redis = new Redis();
$redis->connect('redis', 6379);