Hacker News new | past | comments | ask | show | jobs | submit login

Serious question: why voluntarily choose PHP for a greenfield project in 2019? Less terrible is not a huge selling feature when most of the good stuff in Laravel is lifted directly from Rails but with none of the developer happiness.

The only argument I can think of is that you already have a team of PHP experts and they don't want to transition to Ruby, Node or Django.




I build complex apps. I have been using PHP since 2008.

Prior to taking up Laravel and Vue, it was becoming monotonous to build out websites.

However now with Vue taking up the bulk of work and relegating Laravel to effectively an API for:

- authentication and roles.

- database layer for retrieval and submission

- server side validation

- gateway to the message queue

Fact is, there's so little to use PHP for. I have contemplated moving to GoLang (and may do so in the future). But there is a reason why I stay with Laravel. It's just far easier and far quicker for me to code in PHP than using Javascript (node), GoLang and Python. Couple that with using composer which is a decent package manager. I can iterate very very quickly and have reliable robust code.

Of course, you can argue that the same can be achieved with Rails, GoLang, Python, Javascript, etc, etc. That's great, stick with what works for YOU.

I'm simply not going to put any effort in learning Rails or getting better at another language I know.

I'd rather put in more effort to building out more features and grinding out what matters and that's making sure code turns into $$$. Which is something I think we can all agree with. Use the best tool that you can work with that will do the job well.


It sounds as though we are in violent agreement.


Same question: Who would take Ruby or Django for a new project when the language is not even existing in public discussion?

But honestly, the main reason is that you can find PHP developers everywhere and they are cheap. Given that you want to build a project that grows and advances, that is maintainable, for which you require a vast ecosystem to kick-start your ideas and a lot of very good tooling and free sources of knowledge, you won't find a better platform than PHP.

Ok, Perl might be an alternatively hugely developed language but it is really complicated to find new developers for it. In contrast, you will find a lot of developers, testers, sysops that have the knowledge for working and administering the PHP tech stack. Yes, you could use the coolest language but how would you be able to pay super expensive Go/Kotlin/Node developers once your company has left start-up mode and is there really any gain from that? The risk to be betting on a dying horse might be too high or, less dramatic, everyone is just cooking with water.

If you want to earn money from your company and not just sell your expensive personell at some point it makes sense to start easy and advance the people you have. If you are building API based systems you are not locking yourself in a technology anyways. Given how flexible and fast-moving technology is today one could probably also find a good argument that you absolutely should always base your projects on PHP.


Because those stacks (Ruby/Django) come with automatic admin sections that let you build quite a bit quickly.

But now instead of exposing it as html pages, you expose your django/ruby models using an api like graphql or rest. So then you can use all new fancy js frameworks like react or vue.js.

Ruby and Django developers are as around as much as PHP developers.


PHP is not my go-to tool, but - you can do the same with Laravel (or a number of other packages). Also, my rough impression is that number of PHP devs outweighs Rails / Django at least 2 to 1.


My experience with PHP programmers is that while there are a lot more of them, there aren't a lot of good ones. I suppose if you're just making a fairly simple, server rendered CRUD app, that shouldn't be a problem...


My experience with programmers is that while there are a lot of them, there aren't a lot of good ones


My experience as a PHP (among other things) developer was that "senior" roles pay half what comparable roles with pretty much any other Web language do.

So I'm not a PHP developer anymore, and haven't been for years. Neither is anyone else with options, I'd guess, unless they've found some rare shop that pays real money for them, which I'm sure do exist. I don't actually hate the language. It's OK for what it does. It's a helluva lot less yak-shavey than most of the other popular web languages, so that's nice. I'd work in it again if it paid alright and I wasn't worried the next role wouldn't (that is, that I was killing my earning potential by gaining yet more years of experience in it).


It's honestly really strange that you'd suggest Rails and Django don't exist in the public conversation. Yes, I literally woke up in the middle of the night thinking about this. Rails 6 is on the verge of release and has nearly 4000 contributors. It powers some of the most valuable companies in the world, and is by far the fastest way to get an API/fancy JS combo up and running. According to Github, there are over 1.1 million projects using Rails. Laravel doesn't report usage, but with 500 contributors there's a disparity in the strength of the communities between the two projects.

Anyhow.

One of my favourite things about the Ruby community is that nobody would ever suggest that we're popular because we're cheap. I don't want to work with people that are an easily replaced commodity. Nobody good is cheap.


So you were actually impressed with this project, but instead of congratulating the team you decide to rehash old out-dated arguments and try to bash PHP.

Do you realize this sort of thing is no longer a reflection on the language (folks are immune to it). For people who want to hate just to hate, why are you here on HN? Seriously, go find a subreddit to flame on.


You're reading into what I said in a very negative way, and extracting incorrect signals in the process. I was very clear in saying that if you are a PHP expert, you should definitely continue to develop with PHP.

It should not be negative to ask why someone might choose a PHP framework given so many other options.

I do find it amazing how little credit Rails gets from other framework communities given how many of their features are directly lifted from concepts that Rails originated or popularized. It's possible that Laravel developers don't know migrations came from Rails, for example.

Anyhow, if you're asking about my opinion, personally... don't confuse hate with pity. I've had to make some changes to a Laravel backend for a client project lately, and if you honestly believe that it's nicer to work with than Rails, we have different working definitions of nice.


It's your writing tone, man, tone it down. Your question "why voluntarily choose PHP for a greenfield project in 2019?" was enough, but you followed it with direct criticism. Communication self-help books would be a nice-read


Anecdotally - I find Laravel to be a much more pleasant experience than Rails (from someone who uses both daily, but has been using Laravel for much longer). Can you point out where you think the experience in Rails is better? Maybe I'm missing something...

For a few cases off the top of my head where PHP/Laravel > Ruby/Rails IMO:

- Waaay less magic in Laravel. Controllers are explicitly named, and views are explicitly rendered from methods (Unlike in Rails where everything can be done based on the naming convention of the files).

- Ruby/Rails has too many ways of doing the same thing. Laravel is quite streamlined in that regard. A big part of this is Rails abusing meta-programming IMO (for example, compare ActiveRecord vs. Eloquent).

- I find Laravel's documentation to be top-tier - I rarely have additional questions after reading the relevant sections. And there's official built-in support for a ton of 3rd party services (e.g. Stripe subcriptions).

- Some support for static types in PHP (better than nothing, but nowhere near where I'd like them to be).

- Blade > ERB IMO. Less noise + easier to read. And again, explicit calls to view.render(["var" => $var]) vs. implicit @var insntance variables tacked on to the controller.

Apart from that, PHP is:

- Less prone to memory leaks due to it spinning up a process/thread per request (which can be quite a big advantage - since it means you don't need orchestration overhead for smaller projects).

- Fast enough that performance isn't really a concern (compared to the amount of stories I've heard about migrating away from Rails due to performance problems - I've never heard the same about Laravel).

It feels to me like Rails blazed the trail for developer happiness a few years ago - but these days it seems like a bit of a relic.


I'm a Rails developer and over the last couple years I've been noticing that Laravel is huge. Laravel & Vue is a very common combination these days. From looking at the example Laravel code, it seems quite nice.


this comment is so 2005 and it is suggesting you haven't worked with the latest versions of PHP and the ecosystem around it. From a language perspective, PHP is not any worse than Ruby, Python or Javascript. Composer, Symfony and other libraries have improved PHP projects by a lot.


PHP is still super quirky and inconsistent though. You can't fix that without breaking backward compatibility.


JavaScript is still super quirky and inconsistent though. You can't fix that without breaking backward compatibility.


All web devs used JavaScript because browsers forced us to. PHP is, and has always been, a choice.

As compile-to-JS has matured, many of us have switched to things like TypeScript. That kinda ruins your glib analogy.


Are you saying PHP has improved the way JavaScript has over the last decade?

The improvements in both the language/community plus how people are using JS since The Good Parts was quite a significant improvement.

But people largely went through that whole process because of the ubiquity of browsers not because JS was a good idea. There are so many better alternatives on the server side for web, I don’t see the point in PHP going through that whole renovation unless it’s to hire more and cheaper developers.


> I don’t see the point in PHP going through that whole renovation unless it’s to hire more and cheaper developers.

and may be being cheaper to hire is a bigger importance than you'd care to admit. After all, the person paying the bills wants it to be as low as possible whilst still achieving the result. And they call the shots.


10 years ago, PHP was a good choice for small projects because hosting was much easier and there weren't a lot of cheap outsourced developers for other back-end languages. These days neither of those points is true.

PHP developers are cheap because in general they're very junior. Junior Javascript developers are cheap too.


if you are still selling work based on language and not solutions then you are still jr level as well.


I have worked a lot in JavaScript before and I am pretty up to date with it. Recently I had to pick up PHP for work. I am tempted to say that PHP has become better than JavaScript. I was shock at the improvements.


That’s why people are either compiling from better languages like TypeScript or from modern JS via babel.


Browsers hold figurative guns to our head forcing us to use JavaScript.


Yeah, there’s no reason a sane person should choose either of those.


But you can add extensions which make get rid of the inconsistencies and lets you treat it like you a in a modern version (Babel/etc).

But Javascript is compiled in the browser, by many browsers, and so is hard to nail down an environment.

PHP runs on the server which is pretty much a fixed environment. It has more options to it yet it feels like it hasn't made use of it.


All of the mentioned are incomparably inferior to TypeScript. You have to go to Go, Kotlin, Rust, Swift to actually compare language-wise (to TS) and still won't be able to compare with ability to code the backend and the frontend in the same language.


Not any worse if you don't mind wading through fanfold pages of code containing mostly doc comments, more blank lines than code and pseudo-Java verbosity. No thanks, I'll take Ruby or Python any day of the week.


Can't really know their reasons, but for me - it gets the job done. Not everything is 100% success and require scaling, not everything 100% will grow to huge codebase requiring code burecracy. You can do a lot with PHP until you really hit the wall, and if you get there - it is a good problem to have. Learning new languages and frameworks is great, but it is not required to fulfil business needs and if they have PHP experience and PHP does what they need - it means that PHP is probably a good tool for them at that time.


Why would you not? It's 2019, not 2005.


Not sure, but also not sure you are suggesting these other solutions. I like to use Java, Rust and Elixir for web. Depending on the performance requirements these are better languages.


sometimes developer performance is more important than the server performance. A lot of sites serve less than a page per minute.


Sure but not sure how do you use this to justify Ruby against Elixir.


PHP with modern frameworks is good. And very easy to deploy.


> none of the developer happiness

Weird, because thousands of developers are extremely happy building with Laravel.


The deployment story. It's like AWS Lambda without all the downsides or any vendor lock in.

EDIT: ok sure, it won't scale as well as Lambda without extra work.


Lambda barely has any lock in at all. If you build your app using Lambda and RDS you can transition off AWS easily in a weekend.


Serious answer: It's none of your business, literally. There are probably more valid reasons to use PHP than invalid reasons you can think of. You sound like the kind of person that spends more time in the tool aisle at the hardware store than in the actual garage getting anything useful done.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: