Modern PHP is beautiful and productive

    Almost 8 months ago, I moved from python / java projects to a php project (I was offered conditions that would be foolish to refuse), and I suddenly did not feel the pain and despair that former developers on PCP were preaching about. And here is what I think about this.

    What is what

    To begin with, let me tell you my development experience and the experience of tools in other languages, so that you understand what I'm comparing with.

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

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

    As for PHP

    Before starting work, I read a book: Matt Zandra - PHP objects, templates, and programming techniques, and made sure that PHP, in general, without any particular 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 Zend Framework 1 in PHP 5.3. I must say right away that many decisions on this platform look very controversial, and the PHP 5.3 language has limitations on establishing the type of return of functions (methods), however, you quickly understand where what lies, how what is cast, and how what is formed.

    For example, if we are considering Zend Forms, then they practically do the same work as the classical forms in Django. The syntax for constructing queries in DB Zend DB Table does not cause any negative, and it 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 it 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.

    • Template engine Twig - a complete clone of Jinja from Django.
    • Doctrine ORM - an analog of Hibernate
    • Symfony annotations - an analogue of decorators from Python
    • Auto-wiring Symfony - even more obvious than DI in Spring
    • Obvious configurations of secrecy
    • Convenient construction of rest-APi clients.
    • Convenient spelling of a job for the crown (in this case, they are called console commands in the symphony)
    • Convenient debugger and console assistant.

    Plus, the PHP 7.1 language itself already allowed specifying return types, making multi exception hooks and other nishtyaki. And let's just say that absolutely any discomfort from working with the tool disappeared. And in some places everything works even more conveniently.

    The only fat minus is the lack of documentation. Those. the simplest cases are indicated in the documentation, and everything that is more interesting already requires digging into the symfony source code, and the framework is surprisingly not as popular in Google as we would like.

    Therefore, I have absolutely no understanding why people spit towards PHP when it works and is pretty cool.

    Is there any difference

    I also want to note such a point that after you have worked on 3-4 modern web frameworks, you come to understand that everything works in a similar way everywhere. The names and implementations differ, and the general concepts are 1 to 1. Therefore, let's say, if you worked on Django, then transferring to php Symfony / .Net CORE MVC is possible without too much difficulty for a couple of months.

    PS: if I'm still blind and stupid, please comment.

    Only registered users can participate in the survey. Please come in.

    Do you like working with symfony?

    • 79.4% Yes 560
    • 20.5% No 145

    Also popular now: