phpc.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A server for PHP programmers & friends. Join us for discussions on the PHP programming language, frameworks, packages, tools, open source, tech, life, and more.

Administered by:

Server stats:

834
active users

I'm looking for recent books or up-to-date text on #FunctionalProgramming with PHP. #PHP is changing rapidly and all the books I see are nearly a decade old. Any good recommendations? #FP

Larry Garfield

@worldsendless Mine is from 2020 (PHP 7.4), and is the most recent one I'm aware of.

leanpub.com/thinking-functiona

The changes since that would impact FP are Enums and readonly properties. The rest is still largely valid. (I'm hoping we can get more features into the language that would force me to write a new edition.)

Also check out github.com/Crell/fp/ , which I built sometime after writing the book.

LeanpubThinking Functionally in PHPFunctional programming in PHP 7.4, with a side of category theory and monads accessible to everyone.

@Crell I did look at yours, but Stack Overflow errors have taught me the hard way that PHP has changed a lot recently. Isn't much of PHP different since you wrote the book?

@worldsendless There's a number of very cool improvements to the language, yes. Whether they impact the FP story is the question.

Enums are new. Readonly makes value objects easier, as does constructor promotion. The mixed type is nice in a few cases. Union types don't matter for FP, and neither do attributes.

The core FP story hasn't really changed in the last 4 years. Had any of the FP based RFCs I submitted passed, that would be different, but... They all got blocked.