Live data from Hacker News

PHP in 2019

stitcher.io

331–340 of 489 posts

Re: PHP in 2019

#331
post #2

I've actually been really impressed with Laravel after switching back to PHP for a few projects. Not only is the developer tooling experience some of the best I've experienced, it's just really the only framework I've ever experienced with a high quality ecosystem of tools—from Forge[1], which makes it dead-simple to deploy a Laravel app into production to things like Horizon, for managing Redis queues. A great examp…

In PHP shops I have worked in we would just hand new interns the 'Object-Oriented Programming with Java' book and have them go through that as everything in that book would transfer directly to PHP (and they all new Java).

Then, Laravel, that is the best framework I have ever seen in any language. Comparing it to rails is a huge disservice as it is far superior by almost any measure.

Re: PHP in 2019

#332
post #315

Earlier quoted context omitted.

Often when there is a post about PHP I read over these treads sort of subtly trying to figure out how a language with such a large user base has remained basically invisible to me. And I don't think I live in the HN bubble, though I do use a lot of Python, in my consulting work I've also done plenty of work with .NET, JVM to a lesser extent and other "boring" tech. But PHP has literally never come up, even as a sugge…

Right here! PHP and JS/TS is what I do every day. PHP has its tentacles all over the web: WordPress and Drupal are immensely popular for simplistic sites and short-lived promotionals, Magento and WooCommerce attract many e-commerce users, and Symfony/Laravel handle the custom stuff. I've worked with all of these and have the scars to show for it. All popular projects have swarms of consultants offering advice, prebui…

> [WordPress and] Drupal are immensely popular for simplistic sites

That's not a sentence I expected to see. Ever. Drupal is popular for many things but for simplistic sites?

Re: PHP in 2019

#333
post #308

I've been using PHP semi-regularly since the late 90s. It's been empowering and infuriating. The ecosystem is radically better than it used to be. Composer and the Packagist registry are as mature and dependable as npm, PyPI or RubyGems. (despite hours lost to my own namespace screwups). I'm also happy to see the Prettier-PHP project automating and enforcing code-style standards. For whatever reason, I often feel clu…

I hear this complaint a lot but I find those argument orders completely intuitive. You filter (1) an array with (2) a function. You map (1) a function over (2) an array. You reduce (1) an array with (2) a function. It follows exactly what I'm thinking when I type it. To reverse the orders would be, what? "Mapping an array with a function?" "Filter a function on an array?"

Precisely. Not sure what the fuss is about.

Re: PHP in 2019

#334
post #315

Earlier quoted context omitted.

Right here! PHP and JS/TS is what I do every day. PHP has its tentacles all over the web: WordPress and Drupal are immensely popular for simplistic sites and short-lived promotionals, Magento and WooCommerce attract many e-commerce users, and Symfony/Laravel handle the custom stuff. I've worked with all of these and have the scars to show for it. All popular projects have swarms of consultants offering advice, prebui…

So I get the sense that PHP is sort of the tool of choice for web development at small or medium businesses which are not primarily software businesses, but are looking to create a website and maybe do some ecommerce? Is that right? If so I guess it makes sense that I wouldn't have seen it, most of my consulting work has been at relatively large enterprises.

It definitely feels that way, yes. I've mostly dealt with small businesses looking for the lowest bidder and medium businesses unable to spend a fortune on software licenses and highly-experienced devs, and PHP fits that segment well.

Re: PHP in 2019

#335

php > echo count(get_defined_functions(TRUE)['internal']); 1196 They should clean up the global name space, but that will never happen, so I'll continue not using PHP.

Why does the number of methods in the global namespace bother you? * Genuinely interested in the rationale behind this. Sure, it's a lot, but why does that matter?

Complaints like this one make PHP seem perfect.

Re: PHP in 2019

#336
post #332
post #315

Earlier quoted context omitted.

Right here! PHP and JS/TS is what I do every day. PHP has its tentacles all over the web: WordPress and Drupal are immensely popular for simplistic sites and short-lived promotionals, Magento and WooCommerce attract many e-commerce users, and Symfony/Laravel handle the custom stuff. I've worked with all of these and have the scars to show for it. All popular projects have swarms of consultants offering advice, prebui…

> [WordPress and] Drupal are immensely popular for simplistic sites That's not a sentence I expected to see. Ever. Drupal is popular for many things but for simplistic sites?

This may be a regional thing. I've seen Drupal 6/7 on a lot of sites where the original dev threw together five content types in the admin GUI and told the admin how to post new content. It worked well and was certainly less worrisome than seeing (outdated) WordPress.

Re: PHP in 2019

#337
post #2

I've actually been really impressed with Laravel after switching back to PHP for a few projects. Not only is the developer tooling experience some of the best I've experienced, it's just really the only framework I've ever experienced with a high quality ecosystem of tools—from Forge[1], which makes it dead-simple to deploy a Laravel app into production to things like Horizon, for managing Redis queues. A great examp…

I cut my teeth as a developer on PHP, back in the 4.3 days before they'd really placed their bets on OOP, and we were dealing with mysql_real_escape_string, needles and haystacks, and haystacks and needles. No PDO, XSS and SQL injections up the wazoo.

I can't say I enjoyed working on any of those projects compared to the kind of stuff I do now (and how much I've learned since), but I've been remarkably surprised by some more recent codebases, despite the architecture sometimes feeling a little over-engineered (Symfony 2, for an outdated example).

It's not the style of code I enjoy writing at all but I've seen some incredibly clean stuff that would put a lot of Rails apps to shame. And I'd take that PHP over a badly maintained Rails app any day.

I wouldn't use PHP by choice still, but I no longer care to be snobbish about it. People are doing some good stuff in it, just the same as has happened with JS.

Re: PHP in 2019

#338
post #320

Earlier quoted context omitted.

Unfortunately this is true and it can't be changed, the functions are named and parameters are soemtimes inconsistent like strpos and str_replace, I would have to use the docs all the time if my IDE wouldn't show me the param names. But after you get productive with PHP there is no feature that I think I am missing from other similar languages.

Features that I miss in PHP: - expressive type system with generics, union types, literal types, basically TypeScript. I can say "this function returns a string" or "this function returns an array", but not "this function returns an array of strings". - specialized collection/hashmap data structures with good support across third-party libraries. Having one array() structure acting as both a sequence and an associati…

I am not trying to say PHP > TS, just wanted to let you know in case you still work with PHP codebase that you can get good enough type checks with PHPDoc, here is a good example for the case you mentioned , in Intellij the built in linter will mark as warnings when you use types wrong https://i.imgur.com/NqlAsTd.png (zoom a bit out and sorry for the bad crop)

About the array issue don't we have same situation with JS and TS where you don't have dictionaries or hashmaps in the standard library and you have to use array or object ?

I like JSX too, maybe some PHP template would be made to copy JSX , but not all ages need to be that interactive and not all PHP code is rendering HTML, my current project uses angular1 for the frontend (it was something already created so there was no debate what tool to be used where I could have voiced an opinion).

As a personal opinion I prefer react to angular because I don't like the angular magic compile stuff, I like that react components are JS functions and I can breakpoint into a render functions. I also done some side toy projects with TS, I like it and I hope it gets more popular so new projects would use it but I am worried that we could get a wave of front end languages and we will not have a standard great language but many non standard languages.

Re: PHP in 2019

#339

Earlier quoted context omitted.

I dunno... Their home page looks like something out of the Panera Bread playbook looking at the homepage. 'Web artisans'? Why is it 'clean' because it has an absurd amount of whitespace and comments of platitudes for the code example?

"Clever" "marketing" language like this is not unique to Laravel, most frameworks use language like it for tag-lines on their homepage. Pyramid, a framework for Python, even goes with the same "artisan" language. They're just trying to be fun, inspiring, etc From the home page of a few other frameworks: Django: "The web framework for perfectionists with deadlines." Flask: "Web development, one drop at a time" Express…

It’s not funny. People who have bought in something have (1) to rationalize their choice and (2) cheer so the project remains alive and a major contender.

Re: PHP in 2019

#340

Earlier quoted context omitted.

Yep. Laravel is basically PHP on Rails. They do a great job with it too.

I don't like their code and architecture though. The code is ugly because it is built around static methods instead of proper OOP, and uses magic methods a lot. It is not easy to read. Also, they love to invent their own names for existing things. For example, they named a folder with interfaces as "Contracts", although there are only interfaces. You are using "Ruby on Rails" as some sign of quality, but if it uses m…

> it is built around static methods instead of proper OOP

The fake case against Laravel that never dies . The truth is found in the docs: https://laravel.com/docs/5.8/facades

> Facades provide a "static" interface to classes that are available in the application's service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.

Post reply on HN