Developing microservices in PHP using Expressive + Swoole + ELK stack
Install using Vagrant
You can use Vagrant to setup a Linux
environment to run the
This setup will install the following environment:
- Linux Ubuntu 18.04
- PHP 7.3
- Elasticsearch 6.6.2, Kibana 6.6.2
In order to run Vagrant you need a VM hypervisor like VirtualBox that can be execute on Win, Mac and Linux operating systems.
To execute the Vagrant box you can use the command as follows:
This will require some times (the first execution). When finished, you can see
the application running at
localhost:8080 using Swoole.
The project directory in the VM machine is
If you want to connect to the VM you can SSH into it, using the command:
If you want to close/stop the VM you can use the following command:
Install using Docker
To execute the
php-microservices-workshop application using Docker
you need to run the following command:
You need to install the project using composer:
If you don't have composer installed globally please check this documentation.
Composer will install all the dependencies for this project.
After the installation you need to generate the SQLite database used as example. It can be generated using the following command (from the root of the project):
sqlite3 data/db/users.sqlite < data/db/users.sql
Enable development mode
If you want to customize the application I suggest to enable the development mode using the following command: