1. 19

  2. 4

    I think this is a great step forward for PHP. FWIW, I’ve been reading Symfony: the fast track and it’s quite good, very well-written. I really liked Hack as a language, and I think PHP has largely matched it (even moreso than ES20xx matched CoffeeScript).

    1. 3

      If somebody has no prior knowledge of (web backend) programming languages, what are the reasons to choose php over Ruby on Rails or Django in Python for a new project? Or are the improvements more targeted to legacy applications?

      1. 16
        • It was “serverless” before it was cool. Deployment is super easy: just upload a file. No need to set up reverse proxies or restart anything.
        • Very easy to get started. You can just add PHP tags to HTML. It gets messy if you use it this way, but OTOH it makes the language accessible to people who are just learning to program.
        • It’s pretty fast for an interpreted language.
        • It has a huge ecosystem.
        • Wordpress is incredibly popular. If you’re looking to start a career in programming, setting up Wordpress sites is a good way to get started.
        1. 4

          It was “serverless” before it was cool.

          Which is a huge PITA in modern environments (e.g. kubernetes). Here’s an idea: don’t use PHP! You will be able to use “pull-based” metric systems out of the box, without sub-standard solutions (call me push-gateway), no additional tools to handle DB connection pooling, no complex reasoning for simple tasks. Relying on APCu or another cache won’t save the day. There’s also the log redirection issue in stdout/stderr before PHP-7.3 …

          There are use cases for PHP and I understand that frameworks like Laravel are awesome. PHP is performant, especially v7 (I guess v8 even more so?), but if you’re going to run the app in a dockerised environment you’ll have to fight for things others get out of the box. It’s not pretty.

          1. 10

            As a primarily PHP developer (and dabbling with Golang), I have no idea what you are talking about? But maybe because I’m only developing services for thousands of users, and not millions.

            no complex reasoning for simple tasks

            I prefer simple reasoning for simple tasks ;-)

            I do agree that using Kubernetes or Docker makes things more complicated, that’s why I don’t use them, also I don’t really have a use case for them. Simple OS provided Apache+PHP-FPM running on VMs has been great!

            I understand that frameworks like Laravel are awesome

            I don’t really agree. To me they serve as a warning of what not to do. They add a lot of bloat to your project where that usually is not necessary. If your product is successful you’ll spend the rest of its life fighting the framework and trying to remove it, been there done that :(

            See also: https://phpthewrongway.com/

            1. 2

              As a primarily PHP developer (and dabbling with Golang), I have no idea what you are talking about?

              I would get into additional details but then you go…

              I do agree that using Kubernetes or Docker makes things more complicated, that’s why I don’t use them, also I don’t really have a use case for them.

              …so you do know what I’m talking about :-)

              ps. To address most of the problems I mention, new frameworks have been implemented such as: https://github.com/swoft-cloud/swoft (there’s another IIRC but can’t find it). Still, IMO the best solution is to not use PHP and opt for Ruby, Python, Golang and/or something that keeps state :-)

        2. 9

          Disclaimer: I’ve been a professional PHP developer for a number of years now.

          I think reaching for something like SlimPHP or Laravel is just the same as reaching for Express, Rails, or Django. I prefer the philosophy of PHP execution where each request builds and destroys the entire runtime, where as with these other frameworks, they make your application become a running service. There’s advantages and disadvantages to both, I’m sure, but I like the idea that I don’t have to manage the service itself. I just have to tune PHP-FPM which is what NGINX/Apache/Whatever proxies PHP requests to.

          Basically my point is the language keeps improving from its checkered past and I think its just as viable for web application development as any of the other players in the game.

          1. 7

            It’s not the best comparison. You’d want to look at Symphony or Laravel vs Django or Rails. The language itself has gotten improved a lot, compared to the wild state like 10 years ago. I think that if you learn it properly and use recommended tools and settings, it can be just fine for smaller-to-mid scale projects. It’s just that I think that if you’re just starting and need to learn something from scratch, you could make a better pick. Both regarding the language specs, performance, possibilities, and regarding your hire-ability.

            1. 3

              Shared nothing is a huge benefit for keeping things simple.

            2. 3

              At my place of employ we have a great PHP dev who keeps the business running because at some point a PHP guy built new stuff instead of the old Perl stuff. We also have a great Perl dev who keep things running too because at some point people started the company on Perl. And in a few years we will have a great Python dev who keeps things running…..I am fairly new but I am starting to feel that knowing a particular tool well seems to make you more useful than having opinions on Ramsay tool. So keep going you PHP devs!

              1. 1

                I hope someone comes up with a language that compiles to PHP, that is not… PHP =) Much respect for PHP anyway. My first job was PHP dev.

                1. 1

                  Facebook’s Hack language is basically a fork of PHP—it added some features and dropped support for some other features. I’m not sure what specifically you dislike about PHP, but maybe Hack is what you want.