Why I choose CLI over web interface

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 :

  1. There is no interaction from outside, so no one will communicate with it or even call it from outside the server
  2. It has only one purpose, getting the data and push them to the queue server to be processed later.
  3. needed it to be light, and simple.
  4. 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 dont do it via web.

 

 

Alert! As usual, English is not my first language so if you found any linguistic error just let me know to fix. thanks in advanced.
Filed under: Business, Code, Linux, PHP

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

Comment *

Name *
Email *
Website

18 − eleven =