Live data from Hacker News

PHP in 2019

stitcher.io

411–420 of 489 posts

Re: PHP in 2019

#411

Earlier quoted context omitted.

My issue with modern PHP is that it's essentially becoming Java. And with the JVM and the Java ecosystem, what is the compelling reason to not just pick Java at this point? With Java you are basically writing exactly what you would be writing with PHP, except with more language features and the ability to opt into other languages on the JVM like Kotlin and Scala. The modern additions are fantastic for projects and te…

Interesting analogy, performance wise PHP has made impressive progress. On par with node and the JVM. But Java code specifically is just so bloated. And then there is the worker-per-request model in PHP - All resources isolated to a worker and cleanup on exit. This avoids global garbage collection freezes by design. Something you would get otherwise only from Elixir/Erlang natively. Compared to the JVM that allows PH…

Fun stuff here is that PHP hipsters currently gravitate towards node like runtime models. It isn't really eating the platform right now, but I see it as a risk.

Re: PHP in 2019

#412
post #341
post #27

Earlier quoted context omitted.

There are comparable things with other frameworks too. For example I wrote a course on building a SAAS app with Flask. It's available at: https://buildasaasappwithflask.com/ It covers everything about user registration, profiles, subscription billing, 1 time billing, invoicing, and about 50 other things you would likely want to do in a SAAS app or any application really. The course comes with the source code along wi…

Tokens are issued from within the Spark customer dashboard and the token is required in order to pull the repo during install. It’s basically the honor system.

Thanks.

I noticed they have a public repo with a tool that manages a way to download the spark code base.

I'm guessing without a token you can't access whatever code that public tool pulls down, meaning you need an active token to get future updates of the code base? Pretty cool system if that's the case (there's motivation to keep your purchase to receive updates).

I'm not asking to try and rip him off. I was just curious about the mechanism of protecting the download. Sounds like the only real difference here is the download is done over a command line tool instead of a web interface. Other than that, it's no different than serving a protected file?

Re: PHP in 2019

#413

Earlier quoted context omitted.

Except PHP is not Java, and it never can be. What is PHP's multithreading model again? Hotspot VM? NIO? I'm sure someone will chime in and cite something similar in PHP, but the comparison will be laughable in reality.

I'm not a concurrency expert (haven't had to do much high-performance stuff), but php does have coroutines like go's --if you use swoole, the performance is actually higher than node in some benchmarks and other multi-threaded / parallel programming paradigms, which comforts me to know that if I have the use case it's there, so I don't necessarily need to drop everything and pick up rust or java or go or another lang…

Coroutines do not mean that you get parallel execution. Concurrency is not the same as parallelization.

If PHP does not have JIT, then it's nowhere near the speed of Java. Even if it did, Java would likely beat it significantly. I would encourage you to read about Java's Hotspot VM and its adaptive optimizations.

Re: PHP in 2019

#414

Earlier quoted context omitted.

Genuine question, because I do not know the answer. Does it support: Lexical scoping Coroutines Generators Decorators Generic type containers A functional API (e.g. something like Java 8 streams) An extensive selection of data structures (collections) included in the standard lib ?

> Lexical scoping Yes. > Coroutines No. > Generators Yes. > Decorators No. > Generic type containers In progress. But also PHP has dynamic/weak typing and static/strong typing so this isn't strictly necessary. > A functional API (e.g. something like Java 8 streams) Available as a 3rd party library. > An extensive selection of data structures (collections) included in the standard lib https://www.php.net/manual/en/boo…

Thanks for the thoughtful response. But based on your answers, PHP does lag significantly behind other modern languages. FYI the SPL you linked is quite meager compared to languages like Python and Java.

My opinion remains unchanged. Using PHP in 2019 only puts you at a disadvantage when compared to the alternatives.

Re: PHP in 2019

#415
post #79

Earlier quoted context omitted.

And JavaScript is the best language in the world (with TypeScript).

It's sad how many people think I'm crazy when I say this. No other language feels as good as writing JS with ES6+ features.

Gradual typing (that you can opt-out from) makes for a smooth prototype-to-production experience. Wish more languages supported it.

Re: PHP in 2019

#416
post #262

Earlier quoted context omitted.

The vast majority of people using a package manager in the PHP ecosystem are using composer. It makes sense to call it "the" package manager.

I’d argue that the only “the” is one that’s distributed with it, which is PEAR. I’m not saying PEAR is used more or that it’s better, just that it’s the only one close to “default” with the language distributions.

PEAR hasn't been distributed with PHP in well over a decade, and the last commit to the PEAR "modernization" project was in 2011.

PEAR is an abandoned tool used by no one. Arguing for it to be considered "the" package manager is a really weird fight to pick.

Re: PHP in 2019

#417

Earlier quoted context omitted.

> 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 u…

What isn't fake is that Laravel uses magic methods everywhere, especially in the ORM layer. There are way too many magic things happening under the hood for my taste.

Laravel is moving away from magic methods to using facades, FWIW.

Re: PHP in 2019

#418
post #332

Earlier quoted context omitted.

> [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?

We run about 1,000 simple websites off the same Drupal codebase. Custom forms, page layouts, etc.

So your argument is that a multisite project running a thousand sites off the same codebase containing custom forms and layouts is simplistic? Then, I pray, what do you call complex?

Re: PHP in 2019

#419
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.

Pretty much any shared hosting service (which is the default for a small business not going for a more handheld hosted solution like Squarespace or Shopify) is cPanel enabled with PHP, MySQL (via phpMyAdmin), one-click Wordpress installation, and other similar features.

Re: PHP in 2019

#420
I would say, that PHP faired through time much better than Perl.

May be is Facebook's investment in the platform, may be it is wordpress , the PHP's 'killer app'.

I invested into building a system in PHP in 2010 (and using ignite as framework), when opportunity came to redo it, recently , I picked Java (besides type safety, I also had to build a client as an Android app, so sharing classes across both was another reason for Java).

I would also say that 'health' of a particular language+ecosystem should be measured by 6 variables.

1) new project uptake (OSS) -- eg how many new projects are created using particular language.

2) existing project updates frequency (OSS)

3) leavers (how many projects leave this ecosystem)

and same for non-OSS projects (where this can be measured)

Post reply on HN