Please be aware that this is an old post, more than one year old, so you might need to look for an updated version of this article either on this site or using your favourite search engine.
Yesterday I was working on a piece of code which needs to communicate with beanstalkd server, so I spent about an hour or so trying to figure out which framework to use, Lumen, Slim or even Laravel.
The code was not that much complicated, just getting some data and passing it to the queue server and processing it later. Nothing that much complicated, I even though to do it with plain PHP and not use any framework at all.
Long story short, I ended up creating a PHP CLI application, I mean literally I found it the best solution, so why did I choose to go with CLI instead of any regular web application and make it a web app or even a RESTFUL app.
I went with CLI for few reasons :
- There is no interaction from outside, so no one will communicate with it or even call it from outside the server
- It has only one purpose, getting the data and push them to the queue server to be processed later.
- needed it to be light, and simple.
- didnt need all this mambo jambo of setting up nginx, PHP & SSL .. etc
And the nice thing is that I was able to do it in less time than if I ever wanted to use a framework.
so my advice to you, if you are going to work with microservices try to check if you can do the job via CLI, if yes don't do it via web.
As usual, English is not my first language so if you found any linguistic error just let me know to fix. thanks in advanced.