Live data from Hacker News

PHP in 2019

stitcher.io

461–470 of 489 posts

Re: PHP in 2019

#461
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…

kudos to laravel team (and symfony, since IIRC, laravel is built on top of sf bundles)

Re: PHP in 2019

#462

Earlier quoted context omitted.

Thanks. Again, I am asking out of ignorance: What is PHP's concurrency model? Is it still a forked process pool via something like PHP-FPM, or has it changed? Does the VM enforce a GIL? I'm assuming there is some kind of threading API? Can you run an event loop using epoll, and is the standard library well supported in that execution model? FYI, I was a PHP developer from 2003-2011. I did enjoy it back then. I never…

> What is PHP's concurrency model? Is it still a forked process pool via something like PHP-FPM, or has it changed? > Does the VM enforce a GIL? I'm assuming there is some kind of threading API? As far as I'm aware PHP is still mostly run PHP-FPM. It also does have a threading API: https://www.php.net/manual/en/class.thread.php > But I was ignorant. Honestly, after switching to Python for web dev, I saw no reason to…

That's fair.

I think if you're building CRUD apps over and over again, then yeah, there isn't too much difference.

But if you're building a web service with more complicated business logic and you need more control over your concurrency model, then other languages look more appealing.

And it looks like PHP doesn't have JIT yet, which is another huge mark against it.

So PHP is probably fine for passing params and rendering back HTML. But anything sitting in between that's more interesting should be built in something else.

Re: PHP in 2019

#463
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 installation will be disabled by default in PHP 7.4, see https://externals.io/message/103977. It was a good tool, once, but the community has moved on.

Re: PHP in 2019

#464

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…

In my experience Clojure with Luminus is the quickest for getting something up and running. No brittle ORM to deal with - just HugSQL for turning raw SQL into functions.

Re: PHP in 2019

#465

Earlier quoted context omitted.

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.

Multithreading is not strictly parallelism, typical discussions of multithreading regard concurrency, and multithreading is what you initially asked about. PHP 7.4 will ship with a JIT as an experimental feature and PHP 8 will ship with it built in standard.

Multithreading in Java means parallelism, which is what I was originally asking about.

You're confused. Nowhere did I claim that multithreading always means parrelalism.

Re: PHP in 2019

#466
post #424

Earlier quoted context omitted.

I used both Laravel and Symfony but I ended up with the second. I didn’t like the way Laravel’s ORM has its models structured plus the Symfony PHPStorm plugin is a miracle. Your mileage may vary and this is just me but I never quite understood why people ended up loving Laravel so much vs. Symfony.

I feel Laravel is fantastic for Junior and medior programmers, while Symfony appeals more to seniors.

All the worst projects I've inherited and rescued were Symfony. Developed by senior devs that overengineered. I'm sure newer Symfony is better and there's some good stuff out there but as a decade+ senior engineer I like Symfony components but not the framework. Love Laravel and Lumen and also some of the other microframeworks for some things. Enjoying Laravel Nova right now too.

Re: PHP in 2019

#467
post #445
post #320

Earlier quoted context omitted.

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…

It looks like Facebook had your exact problem; you want Hack: https://hacklang.org It's based on PHP, but adds: Expressive type system with generics: https://docs.hhvm.com/hack/types/generic-types Specialized collections: vec, dict, keyset https://docs.hhvm.com/hack/types/arrays Templating solution similar to JSX: XHP https://docs.hhvm.com/hack/XHP/some-basics

I'm aware of Hack and it's quite nice, but I can't use it because a) my coworkers are … less open to new ideas … and will rightfully resist a "whole new language", whereas mgmt will see it as an attempt at "job security", and b) the biggest use-case for generics is third-party libraries (e.g. [0], [1], [2], [3]) which will never add support if this is not a core language feature.

[0]: https://github.com/doctrine/collections

[1]: https://github.com/schmittjoh/php-option

[2]: https://github.com/schmittjoh/php-collection

[3]: https://github.com/widmogrod/php-functional

Re: PHP in 2019

#468

On one hand, I do see that HN (and probably Reddit) live in a bubble. Where most of the darling languages and tools have very low use in the real-world. And where most of the languages and tooling that actually run the real-world go un-discussed, or simply dismissed, because they're boring and don't appeal to students and entry-level devs working on side projects. I realize that the perspective most rookies get from…

I think the bubble has to do with purists vs pragmatists. I once joined a Java team as a front-end dev (I'm full-stack). They would do the back-end. They had done everything by the book perfectly. Following all the best practices. But the back-end wasn't doing what it needed to do by a long shot. They were stuck. Meaning I couldn't make progress. So I cooked up a simple (temporary) PHP back-end so I could easily buil…

Java guys didn't ship much at my first real gig. Lots of tooling time and watching movies or discussing Star Trek.

I shipped apps in 2 weeks myself that the company got paid ~70k for. And we kept my clients.

Re: PHP in 2019

#469
I'm a front-end guy (with bit of Node.js experience) and I would like to learn PHP and Laravel properly - do you have any suggestions where to start (I would like to learn strong PHP fundamentals as well, not start from Laravel immediately)

Re: PHP in 2019

#470

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…

Java is killing itself at a rate of 6 months. They removed javapackager, which means the official tool to build releases is missing from the LTS version. The EE ecosystem is collapsing thanks to Oracle opposing the Eclipse Foundation, making the quest to build enterprise applications challenging due to namespace collisions and overrides, because of modularisation. PHP is on this aspect still strong and you can still…

You can push libraries privately to GitHub and use with with composer directly, no packagist or anything else required.[0]

[0]: https://getcomposer.org/doc/05-repositories.md

Post reply on HN