Building the inventory service

We will start by implementing the inventory service, as it will use a simple request/reply pattern for communication and it does not have any other dependencies.

Getting started with ZeroMQ REQ/REP sockets

Start by creating the service's composer.json file in the inventory/ directory:

{ 
  "name": "packt-php7/chp7-inventory", 
  "type": "project", 
  "authors": [{ 
    "name": "Martin Helmich", 
    "email": "php7-book@martin-helmich.de" 
  }], 
  "require": { 
    "php": ">= 7.0", 
    "ext-zmq": "*" 
  }, 
  "autoload": { 
    "psr-4": { 
      "Packt\\Chp7\\Inventory": "src/" 
    } 
  } 
} 

After creating the composer.json file, install the project's dependencies using the composer install command on a command line within the inventory/ directory.

Let's start by creating a ...

Get PHP 7 Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.