⬆️ ⬇️

Modern PHP is beautiful and productive.

Almost 8 months ago, I moved from python / java projects to a php project (I was offered conditions from which it would be foolish to refuse), and I suddenly didn’t feel the pain and despair that former PCP developers preach. And that's what I think about this.







What is what



To begin with, let’s tell you about my development experience and how I feel about the tools in other languages, so that you can understand what I'm comparing with.

')

Python. When it comes to projects in python (most often on Django), we get a platform that allows you to quite conveniently and easily increase functionality, build rest-api servers, sharding the system, and so on. The logic of the framework is very clear and straightforward. Even a very green developer can, in a couple of hours, jot down a small blog with an admin panel. Plus the Django documentation is one of the highest quality I've ever seen. To this is added python syntactic sugar, which helps to implement certain patterns very elegantly. If we move away from Django in the direction of Tornado / aiohtpp / Twisted / Flask, etc. - then the pain begins there, because the code in them is much more unpleasant to write than in Django.



Java. If we are talking about Java, for example, Spring - then these are systems that cause anal pain by forcing you to configure everything that can be configured. The threshold of entry is very high, a huge number of nuances to keep in mind, plus the Java syntax itself makes you write very voluminous constructs (true for all projects on the sixth Java). But as a reward, we get very reliable and flexible systems that can survive more than a dozen programmers with very mediocre hands.



As for php



Before starting work, I read the book: Matt Zandra - PHP objects, patterns and programming techniques, and made sure that PHP in general, without much pain, allows you to implement certain development patterns. Those. in PHP you can write the correct code, which will not differ much from what we get in Python / Java.



Zend Framework 1



The internal service project met me with Zend Framework 1 in PHP 5.3. I will say right away that many solutions on this platform look quite controversial, and PHP 5.3 has limitations on determining the type of return of functions (methods), however, you quickly understand where everything lies, what it does, and how it is formed.



For example, if we consider Zend Forms, then they practically do what a classic form in Django does for a carbon copy. The syntax for constructing queries in DB Zend DB Table - does not cause any negative, and very obviously works.



Those. literally in 2-3 days I was able to fully understand and began to write code that did what was required of him in a completely adequate way.



Symfony 3.4



After 3 months, I was transferred to another project on Symfony 3.4 and PHP 7.1 - and this is just a bomb. I frankly had the feeling that they gave me Django pens, where they added the reliability of the system from Java.





Plus, the PHP 7.1 language itself allowed you to specify return types, make multi-exception interceptors and other nishtyaki. And let's say, absolutely any discomfort from working with the tool disappeared. And in some places it works even more conveniently.



The only fat disadvantage is insufficient documentation. Those. the simplest cases are indicated in the documentation, and all that is more interesting, already requires digging into the symfony source code, and the framework is surprisingly not as popular in Google as it should be.



Therefore, I am absolutely not understanding why people spit in the direction of PHP when it works and is very cool.



Is there any difference



I also want to note such a moment that after you have worked on 3-4 modern web frameworks, you get the understanding that everything works the same way everywhere. The names and implementations differ, and the general concepts are 1 to 1. So, let's say, if you worked on Django, then switch to php Symfony / .Net CORE MVC - you can easily without a lot of work for a couple of months.



PS: if I'm still blind and stupid, please in the comments.

Source: https://habr.com/ru/post/445380/



All Articles