Why I may decide to switch from PHP to GoLang

Published : 25/10/2021
Views : 619
Why I may decide to switch from PHP to GoLang

I started writing code in PHP back in 2010. Back then, PHP version 5.x was the latest version available and it was ideal for small - medium web projects. Nowadays PHP has evolved a lot and in its current versions, 7/8.X, it is a full OOP language, with strong frameworks (like Laravel) and a huge community of supporters worldwide. Also performance was a pain point for years, and it has been dramatically improved. 

I enjoyed coding in PHP for many years, and I still do, but in the last 1.5 year I decided to try GoLang. Golang is a simple,  smart, compiled and superfast programming language developed by Google, designed to cover the needs of building modern, cloud applications and support their scaling effordlessly. 

In the following list, you could find some of the reasons why I fell in love with Go:

  1. Built-in dependency manager: You do not need to install extra programs like ‘php composer’
  2. Built-in web server: You do not need to install and configure web servers
  3. Built-in template engines: You do not need to install twig or blade. Go has her own template engine.
  4. Built-in testing package: You do not need to install 3rd party libraries for testing.
  5. Memory Caching: You do not need to store temporary data in a database, in a file or in redis. With Go you can keep data in memory, even when the communication around one request is completed.
  6. Easier package installation: Sometimes in PHP we need to install a package via composer but also need to install and configure the package extension. For example mongoDB requires both steps. In GoLang life is simpler, you only have to install the package via the dependency manager.
  7. Speed & optimised utilisation of hardware resources: GoLang is an extremely fast and compiled programming language compared to PHP.
  8. Dockerfile: No more complexity about configuration in docker file. 
  9. Coding standards: With Golang you have to follow the language standards while you craft your code, otherwise you will get compile errors. This is so important for code readability.
  10. Ideal for microservices: GoLang is designed for complex backend systems and is suitable for cloud infrastructure.

What’s your take on this dilemma? PHP or GoLang? Reach out, connect and let’s discuss. 

Need help with your project?

If you would like to discuss your project with me, feel free to reach out.