· Zen HuiFer · Learn  · 需要5 分钟阅读

What will happen to PHP, which has been "despised", in the future?

Explore the future of PHP amidst rising popularity of Node.js. Despite being criticized, PHP remains robust with a large community and mature frameworks like Laravel and Symfony. Ideal for stability and long-term projects, PHP also sees performance boosts with PHP 8.1.

Explore the future of PHP amidst rising popularity of Node.js. Despite being criticized, PHP remains robust with a large community and mature frameworks like Laravel and Symfony. Ideal for stability and long-term projects, PHP also sees performance boosts with PHP 8.1.

What will happen to PHP, which has been “despised”, in the future?

Business cooperation with WeChat: 2230304070

Learning and Communication: PHP Technology Exchange WeChat Group

PHPStorm activation

https://www.mano100.cn/thread-1942-1-1.html

Nowadays, disliking PHP and praising new technologies such as Node has almost become a fantasy. Especially in young communities, PHP is considered a ‘dinosaur’.

PHP is a great programming language.

It’s not perfect, there are pros and cons, but overall, if you work in web development, it’s best to try to understand it instead of following the trend and hating it

You can even learn something from it!

Let’s take a look at the differences between PHP and Node, which have kept many people on the PHP platform and also led others to switch to different programming languages!

》》Laravel idea plugin activation code《《

community

The PHP community is larger than the Node community.

The NPM/Node community is also large, but there is a lack of people who can truly maintain and do well in Node packages.

Many modules have been abandoned or no longer updated. The worst part is that most modules rely on a large number of other modules, which means that if the module you are using relies on an old module that contains vulnerabilities, you may not be aware of it or need to spend a lot of time updating everything yourself.

This is important because no matter how good a programming language or framework is, if no one maintains it, or if there is no discussion, PR, or open source project about it, it will eventually perish.

The PHP ecosystem provides you with a large number of libraries: JWT authentication, generating Excel spreadsheets and PDFs, cache management, ORM frameworks… These libraries are widely used, have good security, and provide excellent documentation.

The Symfony framework also provides some official documentation, such as Lexik JWTA Authentication!

In fact, about 80% of web applications are developed using PHP.

frame

Symfony and Laravel, the two main PHP frameworks, are now a huge component of the web. Laravel is very popular in the United States, and Symfony is very popular in Europe. If we remove WordPress, these two frameworks account for over 90% of the PHP ecosystem.

These frameworks are older than most Node frameworks and have a broader ecosystem of packages and documentation than current Node frameworks.

Did you encounter any problems while using Symfony? Version 3? Version 4? This is nothing! A large number of StackOverflow posts, Medium articles, and official documents are available for your reference.

Symfony and Laravel also provide some ‘basic project structures’, which you can of course not use and build your project in the way you want, but these basic patterns are usually applicable to various types of applications.

In most cases, we can adjust them through configuration to meet our various needs. Since these frameworks have been around for several years, most of the useful features you may think of already exist, as the developers before you also had the same needs as you.

Taking Express as an example, it is the most famous framework for Node, mainly used for writing APIs, and it does not provide mandatory structures. This means that an inexperienced developer is more likely to build something that does not meet the standards, and PHP frameworks have much less risk in this regard.

performance

Node is very fast, in some cases faster than PHP, but PHP is not too bad either.

PHP 8.1 achieves faster execution speed through OPCache and JIT compilation.

Node utilizes its asynchronous nature in terms of speed, but it is single threaded. PHP takes advantage of running on multiple threads and is synchronous.

In fact, the price of servers nowadays is generally not very high, and scaling a web application has never been easier than it is today. For small web applications, given today’s computing power, performance is no longer a point worth debating for too much time.

However, for large-scale applications, price may be a concern.

That’s why replacing the commonly used PHP-FPM/Nginx stack with Swoole would be a good choice.

I have seen some PHP applications using Swoole as the underlying HTTP server, which outperformed Node in terms of performance!

In addition, using message queues is a great way to balance application workloads, which can be easily implemented using PHP and Node.

Usability

Although Node/Express is often used to write APIs and communicate with front-end frameworks built using React/Angular/Vue, most PHP frameworks adopt the MVC pattern.

MVC stands for Model View Controller. A picture is better than a long speech: If you are not familiar with MVC, here is a picture that can help you quickly understand the MVC pattern.

Building a front-end and back-end separated application is usually slower than using a framework that supports front-end and back-end technology stacks. In fact, many backend developers know how to write excellent HTML/CSS, but are not familiar with the concepts or syntax of React or other frameworks.

conclusion

PHP and Node each have their own advantages and disadvantages.

If you need stability, reliability, and long-term support, I recommend using PHP.

These frameworks are mature and secure, and in my opinion, they are the preferred choice.

However, for APIs that require high throughput and real-time data processing, Node is a good choice. Additionally, there are some projects that cannot be completed using PHP, such as Discord bot (although it may be possible to implement it using PHP, there is already an official JavaScript library available…)

Sometimes, it’s also good to develop applications in another programming language. We can discover new concepts or ways of doing things from it, and then apply them to other programming languages.

返回博客
New package in Go 1.23: unique

New package in Go 1.23: unique

Go 1.23 introduces unique package for value normalization, enhancing memory efficiency and equality checks. Learn how "interning" works with unique and its benefits for Go developers.

How to cache well in Go

How to cache well in Go

Optimize Go app performance with caching strategies. Learn local vs distributed cache, memory management, and eviction policies. Enhance efficiency with Go's new unique package.

The noCopy strategy you should know in Golang

The noCopy strategy you should know in Golang

Discover the importance of noCopy in Golang development. Learn how it prevents accidental copying of critical structures like sync primitives. Enhance your Go code safety and efficiency.