Home >Backend Development >PHP Tutorial >Looking back on 2018 and looking forward to the development of PHP in 2019

Looking back on 2018 and looking forward to the development of PHP in 2019

不言
不言forward
2019-01-01 10:15:219312browse

Looking back on 2018 and looking forward to the development of PHP in 2019

Course start notice: php Chinese website "The 10th PHP Online Training Course" is currently being registered!

PHP has a history of more than 20 years since its birth. From the rise of the Web era to the ebb of the mobile Internet, various programming languages ​​and technologies have emerged in the Internet field. Node.js, GO and Python continue to emerge. It is challenging PHP's status. The promoters of these technologies are very keen to badmouth PHP. What is the future of the PHP language? How should PHP programmers cope with future changes?

As a veteran Web back-end programming language, PHP has a very high global market share, second only to Java. From the data of various recruitment websites, it can be seen that there are many positions for PHP development, and the salary level is also very good. In fact, the market position of PHP in small and medium-sized enterprises and Internet startups is higher than that of Java. Java has greater advantages in very large enterprises, traditional software industries, and financial fields. At present, Node.js, GO, Python, Ruby and other languages ​​are still difficult to match PHP and Java.

The reason why the PHP language has achieved today's status is due to the fact that the designers of the PHP language have always followed pragmatism and hidden the technical complexity at the bottom. The PHP language is simple to get started with, easy to master, and the program is robust. It is not prone to complex problems like Java, C and other languages, such as memory leaks and crashes, and tracking and debugging is relatively easy.

Looking back on 2018 and looking forward to the development of PHP in 2019

The standard library officially provided by PHP is very powerful. Various functions can be found in the official standard library, including MySQL, Memcache, Redis, GD graphics library, and CURL. , XML, JSON, etc., eliminating the trouble of developers looking for libraries everywhere. PHP's documentation is excellent, with detailed descriptions and usage examples for each function. Third-party libraries, tools, codes, and projects are also abundant. Developers can use PHP to write and develop various software quickly and efficiently.

So far, there is still no programming language on the market that is simpler and easier to use than PHP. Therefore, the prospects of PHP are still very broad. Instead of worrying about the choice of programming language, it is better to learn and use PHP in depth.

As a senior PHP developer, I would like to give you some technical suggestions for the future of PHP programs. I hope it will be helpful to everyone.

 01 Composer

The first point is to mention Composer. Since the emergence of Composer, PHP dependency management can become very simple. The program relies on some class libraries and frameworks, which can be introduced directly using Composer, and the dependent packages can be installed using composer update. Various difficulties in loading external libraries in the past have been solved.

Composer also has domestic mirrors, which are very fast. Nowadays, most PHP open source projects provide support for Composer. It is recommended that you use Composer to solve the problem of PHP code package management in your project, and do not use the original method of downloading source code and manually including it.

Recommended tutorial: Instance tutorial on using Composer under Windows

 02 PHP7

The PHP7 version has made a lot of modifications to the Zend engine, which has greatly improved PHP Language performance, using PHP7 can instantly double the performance of your program. Even heavyweight software like WordPress can achieve thousands of QPS when running on PHP7, which is equivalent to a server that can handle 80 million requests per day.

Use PHP7, optimize MySQL, and use Memcache and Redis for acceleration. This technical architecture can fully cope with quite large-scale systems. Except for some platforms with hundreds of millions of users, systems of average size are completely stress-free.

 03 PSR

PSR is a PHP language development specification formulated by the PHPFramework Interop Group. It stipulates many rules, such as namespace, class name specification, coding style standard, Autoload, and public interface. wait. It has now become the de facto standard in the PHP technology community. Many well-known PHP frameworks and libraries comply with the PSR specification.

PHP developers should learn to master the PSR specification and try to follow the PSR specification when developing programs.

 04 Swoole

 Is PHP still limited to web websites in 2018? No, if you don’t know Swoole yet, go and find out about it. Swoole's slogan is to redefine the PHP language. Swoole is an asynchronous and parallel communication engine that runs as an extension of PHP.

There is an asynchronous callback Swoole in Node.js, and there is also a coroutine Swoole in the Go language, which completely subverts the understanding of PHP. Using Swoole PHP, you can implement a memory-resident server program and realize the programming development of TCP and UDP asynchronous network communication.

In the past, PHP could only build a Web website, but now Swoole can be used to provide communication services that can only be implemented in Java and C, such as WebSocket communication, chat, push server, RPC remote calling service, gateway, proxy, and game server. wait. If you want to use PHP to do something other than web systems, Swoole is the best choice.

 05 Laravel

The most popular PHP framework in recent years, the official website claims to be a framework designed for Web artists, which shows how elegant this framework is. Laravel provides rich functional modules, simple API design, and strong expressiveness. Moreover, its community is very active, there are many code contributors, there are many third-party plug-ins, and the ecosystem is quite prosperous.

Laravel uses a lot of symfony2 components at the bottom layer, and realizes dependency management through composer. If you are still wondering which PHP framework to use, it is better to choose Laravel. The command line tool provided by Laravel is based on symfony.console and is powerful. It integrates various project management and automatic code generation functions.

 06 Phar

After PHP5.3, a Java-like jar package is supported, named phar. Used to package multiple PHP files into one file. This feature allows PHP to package and componentize applications as easily as Java. An application can be packaged into a Phar package and run directly in PHP-FPM.

With Swoole, you can execute php server.phar on the command line to start the server with one click. PHP code packages can be packaged into components using Phar and placed in Swoole's server container for loading and execution.

The above is the detailed content of Looking back on 2018 and looking forward to the development of PHP in 2019. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:oschina.net. If there is any infringement, please contact admin@php.cn delete