13
41 Comments

Do you still use PHP?

I see many developers working with Node.JS / Go / Python.
I am not a real developer but I love to use PHP for my applications, what are the benefits to use something different than PHP?

on October 5, 2020
  1. 7

    I use Ruby on Rails. The productivity is just unbeatable. I can build complex things very quickly with it. The only downside is that it costs more than other options to scale. I also like Elixir/Phoenix for performance and concurrency, but it's not quite there yet in terms of productivity compared to Rails, so for now I am sticking with Rails.

    1. 1

      what problems did you come across while trying to scale Ruby on Rails? I write all my apps in Rails as well – haven't faced any problems in scaling them.

      1. 1

        It's just more expensive because Rails needs more memory etc than other solutions and if you compare Rails with others it yields inferior performance with the same resources. But the gains in productivity are immense as you already know.

        1. 1

          I run a couple of Rails apps on a single $10 DigitalOcean droplet without any memory issues. Sure, at times there can be memory related problems when running bundle install but once you are past that then everything works smoothly.

          Also, let's say even if you are running into performance issues then simply upgrading to the next plan (perhaps spending $5-$10 extra) should solve your issues.

          Honestly, I would anyday prefer upgrading server specs rather than investing in learning a new language.

    2. 1

      it costs more than other options to scale.

      At that point you can probably invest resources in proper scaling. Github and Shopify don't seem to have problems.

      1. 1

        Yep, they are huge and it works for them indeed, so it can work for us.

  2. 3

    I use JavaScript because it’s what I know the best and because I can use it across the entire stack. Almost anything can be done with it. I can make backend, frontend, native apps and so on.

    However, JavaScript is objectively not as productive as Ruby/Rails or PHP/Laravel for Indie Hacking. But for me it strikes the perfect balance. Sometimes I hate it but most of the time I feel great about choosing JavaScript as my “home turf”.

    You know best if you are able to solve your problems with PHP. It is a fantastic choice for so many things. You should feel great about using it. Cheers!

    1. 2

      JavaScript is powerful, I don't know why there isn't a strong backend framework for it yet (like Laravel and Rails). I use Express but not really good for productivity.

      What's your stack?

      1. 1

        I love React, so that's what I use for almost everything. For the backend I don't have a favorite, but I like working with GraphQL and serverless tech (mostly on AWS).

  3. 3

    I used PHP for years before transitioning to Ruby (and now dabbling in Go).

    But end of the day, use whatever works for you and that you can be productive in. I recently had to use Laravel for a small project and was surprised how nice it was compared to raw PHP that I used to use before. Use whatever works. Don't be distracted by the latest shiny thing.

  4. 2

    PHP uses a stateless processing model. This means the interpreter runs only on a request and therefor might have to do a bit more than in other processing models. PHP and its frameworks have come a long way (OPcache and the JIT in PHP8 helps), but if you want to move tasks outside of the request scope things get ugly - fast. PHP has stuck to the idea of server pages - for better or worse.

    There is still a lot of PHP out there and does the job for many, but I would be very reluctant to invest time or money to bring it willfully into a current tech stack.

  5. 2

    I started as a PHP developer, even a contributor to Laravel, but I got bored with PHP and switched to Node/JavaScript in 2015.

    PHP is still fantastic and don't let what other people are using deter you from using it.

    1. 3

      The same for me, I moved from PHP to Node js just to build full-stack apps using one language, and to avoid the SSR issues when building single-page apps using VueJS.

      I can't find anything in NodeJs to compare it with Laravel in terms of productivity.

      What's your stack @joshmanders?

      What do you think about Laravel livewire? I see that it can replace frontend frameworks in the future so we can build dynamic apps using PHP.

      1. 1

        I am not too familiar with Livewire, but it looks nice.

        My stack is microservices with Moleculer/Kubit (Kubit is my own framework not open sourced, yet), TypeScript, React and Next.js

  6. 2

    It's entirely based on what your building.

    But, generally, PHP has proven itself as a language: it has a huge active community, many frameworks and libraries and is actively pushing major performance and security releases at the core.

  7. 1

    I'm a JavaScript junkie, I code most of my projects with MongoDB, Node/Express, and React. I initially started with these because I didn't want to spend a lot of time learning multiple languages just to make a full-stack application. Now they've stuck and I actually love the open ended, scalable, async environment that React and Node have to offer.

    I've also picked up Python for machine learning extensions of my APIs, and obviously Python is famous for its computational powers and supporting libraries

  8. 1

    Yes. The way PHP works is thought is great, but PHP isn't. There are many bad things in PHP were I just wonder how anyone would think this is a good idea to implement in a programming language.

  9. 1

    For me If it's just a simple website I use PHP otherwise I use Nodejs.

    The reason why, Nodejs is a complete webserver, you have complete control over your code, unlike PHP which is simple scripts executed by an external webserver, you are a little bit limited on that side.

    As a simple example you can't make realtime applications with PHP alone as every script is executed on its own scope, there is no one shared place for all requests, I don't know if you get the idea.

    But eventhough PHP is still amazing you can do alot of stuff if well used.

  10. 1

    I use PHP for all of my projects and at my job I use Node, they use Node at work purely because of hype & companies love hype (especially big ones) so don't get caught up in it. I find Node to still be slow when developing because of setting up/using the tooling; but use what you feel comfortable with.

  11. 1

    I use PHP for userTrack.net because it is still the easiest and cheapest platform to host. Most developers and non-technical people are used to WordPress, cPanel and shared hostings that run on the LAMP stack.

    For my own projects I usually go with Node.js, but I love PHP because there is no compilation step (interpreted language), I can always edit files, publish them and the live site updates instantly.

    I see many developers working with Node.JS / Go / Python

    I do think there are still more PHP devs than all of those 3 alternatives combined, as there is a lot of legacy code that has to be maintained or new applications created for existing PHP ecosystems.

  12. 1

    I'm still using PHP with blazing fast Comet: https://github.com/gotzmann/comet

    Cant wait for PHP8 with JIT and all that great new features :)

  13. 1

    Yes and I use Laravel which is great for getting an app running quickly!

  14. 1

    (Plain) PHP is my favorite language, but recently I'm addicted to Node.JS + socket.io.
    Anything you can do in PHP you can also do in Node.js.

  15. 1

    PHP is my go-to for any new project. SplitWit is written entirely in PHP. I also support a lot of websites that run on WordPress.

  16. 1

    I find this quite funny since I just posted about my startup's tech stack which runs entirely on Laravel (the PHP web framework of choice). The main reason I went with it? Cause it's proven, fast and I can iterate very quickly. Link to my article: https://www.valcanbuild.tech/a-bootstrappers-tech-stack/

  17. 1

    Laravel on my own projects and WP on agency sites. What I learned on and super knowledgeable after 10+ years :)

  18. 1

    Absolutely!
    I want to give Nest.js a try, but that's more because I really like Typescript, not that I dislike PHP or have any problems with it.

  19. 1

    Yes I still use PHP in web building

  20. 1

    Sometimes the best language is the one you know.

    What kind of development do you do with php? Are you building on WordPress? Do you have a need to do something that you can't solve with php?

  21. 1

    I have been working for a long time with php/laravel/symfony so my opinion might be biased towards php, however it all boils down to what are you familiar with and what are the expectations of your application. I worked on projects with node, go, python, php and if somebody came to me today and asked what tech stack they should use for their next web project I would suggest php with laravel because it would be the quickest way from first commit to deployed application and because this is what I know the best. Laravel has fundamentally transformed the ecosystem of php with this "batteries included" framework approach - they provide you with almost everything that you will need to develop web based applications and this can drastically reduce the time that you need to spend developing things.

    However, if you want to do something more complex stuff that needs speed, some kind of big data processing, image manipulation, distributed microservices, etc Go would be better choice because it is compiled language with very efficient concurrency model.

    With that being said, you should choose between node/python/php/ruby by trying all of them and sticking with the one you like the most, as you won't notice a big difference in speed among these languages.

    P.S. Programming language is just a tool that helps you achieve something. Some languages do some things better than others as they were designed for specific tasks.

  22. 1

    go for example compiles to machine level binaries, making it considerably more efficient than php or ruby if you need pure CPU performance as well as has native multi processing..
    Node.Js has the advantage of learning one language instead of two for front and back end part, at least in theory.
    go is a bit young in terms of it's ecosystem and core components...
    some people like typed statically compiled more and some like scripting dynamically types...

    For simple projects it probably doesn't matter much... give it to 4 developers each with their preferred language, the results would all be comparable.
    There are more non-developer, simple website builders in php, which sometimes makes things confusing as they can hack and patch some things together but lack basic programming understanding... I think it's more common in php due to the popularity of wordpress basically, but it's just a BS story.

    1. 4

      Even the biggest and largest top 10 websites have PHP. I think the backend language fight will never come to a conclusion. At the end we have to build products that solve problems and make money in turn.

      1. 1

        This comment was deleted 4 years ago

        1. 1

          If you go through reddit forums and the like, it comes to an extent people abuse each other just for a fact that one is a node enthusiast and the other is a PHP lover, how do you call it?

          1. 1

            This comment was deleted 4 years ago

            1. 1

              absolutely right..

  23. 0

    The advice here of just using what you know and like the best to achieve the end goal you want is the best advice anyone can give on this subject.

    There are snobs out there that think you should use X language because of Y but they all seem to forget one vital point.

    End users do not care what language you use, only what you produce with it. Focus on building a good experience for your users, regardless of what tech you need to use to get there.

  24. 17

    This comment was deleted 4 years ago

    1. 2

      FB's infra is largely C++ and the "PHP" they do still run is a typed variant of PHP they created (along with an entire VM).

      95% of people worrying about PHP's performance shouldn't be but it's absolutely not a go-to choice for performance-critical systems.

      1. 1

        True, they have their own VM.
        Also, it it is that good to facebook, why they have created ReactJS?

        1. 1

          React has nothing to do with PHP. It's front-end.

          Back when React was first created, Backbone.js was the dominant front-end organization library and while it worked well for many things, it was definitely more of a pain to do certain things.

          For example, rendering a "child view" (aka component inside a component) wasn't at all intuitive. It was easy to get bugs where the parent view got re-rendered or where the child view's events were broken. The solution was generally to re-assign the child view's container element after the parent view rendered and then delegate events like this:

          Example.ParentView = Backbone.View.extend({
           
          	childView: new Example.ChildView(),
           
          	render: function() {
          		this.$el.html(this.template(this.model.toJSON()));
          		this.childView.$el = this.$('#child-view-container');
          		this.childView.render();
          		this.childView.delegateEvents();
          	}
          });
          

          Many, possibly most engineers I knew, reached for another library on top of Backbone for larger projects. Marionette and Thorax were a couple that had a more ergonomic way to do child views.

          In contrast, React made it very straight forward to put components inside other components. It also side-stepped the two-way binding messes that the other rising competitor, AngularJS, was prone to. Angular2 and later borrowed quite a few ideas from React, actually. Similarly Vue and Svelte have learned from the rough edges of React. It's not a straight line, but there's definitely been a lot of progress.

          In any case, there's no way Facebook wanted to use a Google-controlled library. There's also a recruiting advantage to having their own open source project used.

    2. 2

      I couldn't agree more. I avoided learning PHP when I learned to code because of code snobs. Now I'm a dev that spends 99% of my day writing PHP. Wish more starters knew how great PHP is.

    3. 2

      100% - I've moved away from PHP over the last decade, but that's a personal preference. PHP is a stable, reliable language with excellent tooling and amazing libraries and frameworks (Laravel, Yii, Symfony).

      The truth is web-app developers are spoiled for choice these days. There are awesome options all over the place. Ultimately, unless you are working on unusual projects with very specific performance requirements, the best language is the one you are most productive in.