PHP Microservices: Functional Programming and Unit Testing
One of the best benefits of Microservices is the size of the applications, they are tiny! Only a few hundred lines of code, maybe a few files, and you have a service that is fully functional. We’ve have done it several times in our past microservice tutorials:
- Socket Programming with emails as an example
- Using A Queueing System With RabbitMQ
- Create A Restful CRUD API
- Authentication and Authorization
Because of the application smaller sizes, we focus on methodologies and processes that can greatly improve the quality of your code and the productivity of your team. Two approaches two adopt are:
- Functional Programming
- Unit Testing
Run The Code
The code for this tutorial is available at: https://github.com/ProdigyView-Toolkit/Microservices-Examples-PHP
Use the folder named security
and follow the README.
Functional Programming
Brief Overview of Functional Programming
Functional programming can be described as the opposite of object-oriented, or as some may describe it as being declarative and not…