18 February, 2020
Back in the day, when newspapers mistakenly printed the obituary of Mark Twain, the famous author said that “the reports of my death are greatly exaggerated.” If PHP had a mind (and mouth) of its own, it could say the very same thing.
PHP’s paradox – ubiquitous, yet overlooked
Despite becoming more efficient and object-oriented than ever, PHP is often overlooked as an option for developing modern, innovative applications. The common consensus among some developers and business decision makers seems to be:
- Despite being used by as many as 79 percent of all websites, it’s mostly suitable for simple content-based websites rather than applications.
- It excels in generic (from a programming standpoint) projects such as CMSes based web portals and eCommerce stores.
- It evolves slowly, being behind its competition (e.g. Node.js) when it comes to the support for many innovative technologies for building highly interactive applications (e.g. microservices, websocket etc.).
And yet, PHP is at the heart of some of the most famous and successful technological companies of their kind in the world, including Facebook, Blablacar, or Slack (and the team behind the famous instant messaging app has quite a story on this topic). A lot of smaller startups also make informed decisions to choose PHP and stick to it in the long term. Why?
That’s because not only is PHP getting better all the time, but it also provides many unique advantages for both developers and business. Despite the stereotypes, it’s also capable of working with WebSocket (but it does have limitations here – read the linked article to learn more about it), microservices (more on that further in this article!) and many other trending technologies.
Let’s analyze some of the most interesting circumstances when PHP may just be the right answer.
PHP is used…
1. …when you prioritize time-to-market and want to test your business idea as soon as possible
Do you have a business idea and wish to hit the market as soon as possible to find out if it can become the next big thing? It’s a good idea to release fast for many reasons, including the ability to save a lot of costs when the endeavor doesn’t work out. A quick start may also lead to finding new business models you previously have not even considered.
If your business idea also calls for a web app, PHP is the perfect choice. When it comes to time-to-market, PHP excels because of how quickly you can develop with it. It’s thanks to the two most popular PHP frameworks Symfony and Laravel and an incredible choice of ready-made dedicated libraries that comprise their ecosystems. Startup investors expect quick results and PHP can definitely help you deliver on your promise and meet their expectations.
PHP is used…
2. …when SEO optimization is of utmost importance
Most B2C web applications must be not only extremely easy to use, but also to find, in order to ensure success with their potential clients. Online stores and other eCommerce projects are the best example of that. If we want our web app to rank high for various keywords in popular search engines, we need to take that into consideration during development. Search engine robots favor clean HTML, because it is much easier to crawl and read. And outputting such code is the very reason PHP was created in the first place. Wikipedia is a prime example of a PHP-based website that attracts immense traffic from organic search engine results. As a matter of fact, every time you arrive at a text-rich website that ranks high on Google, there is a very good chance it was written in PHP.
Symfony and Laravel also go a long way to help us build SEO-optimized websites thanks to great template engines such as Twig or Blade. They provide flexibility in design, all the while outputting search engine-friendly code.
PHP is used…
3. …when app stability is crucial for your business
Being (extremely) actively used and developed for well over two decades, PHP is a very stable solution. Symfony and Laravel have also been a part of modern app development for many years (15 and 10 respectively). Over time, they have matured and got rid of most flaws. They are still being improved in response to the latest technological trends and expectations of developers.
PHP is used…
4. … when you need a REST API for your mobile application
All the major PHP frameworks provide great support for REST API. The Symfony framework even offers a whole platform dedicated to the development of APIs, both REST and GraphQL. It’s called API Platform and it makes it possible to quickly create APIs only by adding the business logic.
API Platform automates a lot of typical tasks, making the whole API development process amazingly efficient. We get a full documentation of our API in OpenAPI/Swagger format to boot. Since the documentation is created and updated automatically, API users don’t ever have to worry if it’s up-to-date. In addition, API Platform enforces a very stable structure of responses. In addition, when our project is a simple CRUD application, the platform pretty much provides us with the entire working structure, at a minimal effort.
PHP is used…
5. …when you are interested in microservices-based architecture
Surprised? But it’s true! The thing is that microservices-based architecture hides the implementation behind the interface, which is nothing else but an API. It means that it’s easy to change the technology that works behind the hood, without affecting the services that use the API. And I’ve already said why PHP is great for making APIs.
Why is PHP not so popular when it comes to microservices then? I think that the main reason is that PHP developers have a healthy attitude towards microservices and don’t try to fit them into just about any project. Microservices can be an extremely efficient solution, but mostly for really big projects, meant for high scalability. They are difficult to handle when it comes to deployment and cross-service compatibility. For many smaller projects, the cons often outweigh the pros. And that’s why a reasonable approach to microservices should be more appreciated.
What do you think – is any of the arguments for using PHP in modern app development in 2020 relevant to your project? Or perhaps you’re not sure? Whatever is the case, you’re welcome to contact us and tell us the story behind it. Let’s figure out the best approach for your needs.