What's new in PHP 8.1
- enums
- fibers
- array unpacking with string keys
- `new` in initializers
- readonly properties
- first-class callables
- the `never` type
- `array_is_list`
- and more, so exciting!
PHP 8.3 will have a new json_validate function that basically does what its name says. Previously we had to combine `json_decode` with `try/catch` to make sure a JSON string was valid. This function also requires less memory than the old workaround.
PHP is NOT becoming java. PHP is so much more than its syntax. It’s an ecosystem, a mindset, a community.
Besides that, the language itself is still very different. PHP is as close to Java as it is to C++, C#, Ruby and Python.
Some important news: today marked my last day
@spatie_be
, and I’ll start my job as dev advocate/content manager
@phpstorm
next Monday!
I’m gonna miss my awesome colleagues, but I’m also very excited!
So my wife and I are working on a new side project, we're having a deadline for May, 2021. To be honest, she's doing most of the hard work at the moment 😌
New in PHP 8.2: redacted parameters 🤩
You can mark parameters that potentially contain sensitive information with the #[SensitiveParameter] attribute in order to prevent their data from ending up in stack traces:
I wish PHP objects were constructed via ::new(), allows for much easier method chaining.
I often find adding that little `new` method on many of my classes, just because it's so useful.
Rust, for example, uses the `::new()` approach, much better.
The DRY principle is one of the most abused ones in software development.
By all means, DO repeat yourself until you're sure that the abstractions you're thinking about are the right ones.
Can I say something 🌶 ? (gonna do it anyway).
I've used both Smarty, Twig and Blade in my decade of development, and I've used them more than "let's play with it for 10 minutes"
Blade is BY FAR the best template engine to work with in PHP.
That's it.
The dynamic properties deprecation RFC has passed.
Let me say something that I know is controversial here on Twitter: I think this is a good thing. PHP is evolving towards a stricter and more mature language.
In 10 years, we'll be happy we did this.
The amount of new features being added to
#PHP
7.4 is astonishing. Here's yet another RFC that's likely to pass: spread operators in array expressions.
$others = ['b', 'c'];
$arr = ['a', ...$others, 'z'];
Can you believe it? PHP 7.4 support will completely end by November 28. That's in less than two months!
7.4 was one of my favourite releases, but it's good that support ends after three years, and that the language moves on.
Friday last week, our baby girl was born: Alina Lore Roose. It was a complicated pregnancy but she’s doing amazingly well!
I’ll be AFK for a couple of weeks :)
I've spent four days thinking about a programming problem and how to solve it. Yesterday evening it finally clicked and I've managed to fix it this morning 😁 Feels great!
Does anybody else sometimes "code mentally" trying to solve something or is that just me? 😅
I'm seriously thinking about how I would give shape to a book about designing Laravel applications beyond basic CRUD. I'm working on a draft and hope to gather people's feedback soon(ish).
PHP 7.4 is still a long way away, though people are already working hard on it. If all goes to plan, this might be one of the best
#PHP
updates in a long long time.
I have to admit something…
I cannot imagine writing any kind of simple webapp without
@LaravelLivewire
anymore.
Feels so weird having to do a full page refresh for every form, every button press, every pagination request, …
We’re spoiled 🤗
I'm giving away five elephpants (in case you didn't know that yet).
Do you wanna get one? I'll pick two random followers who retweeted this tweet next week. Simple 👍
I've been thinking a lot about request validation lately. In our projects, we map raw, incoming data to DTOs in order to use type information in complex processes. That comes with a bunch of overhead. Why not skip that overhead?
before / after
(poll at the end of the thread)
Now, I don't mean to alarm anyone, but I've been tinkering with writing a code highlighter in PHP, and it actually might be something useful…
- Extensible
- Super fast
- Server side
- Language injection support
- Modern PHP support
Anyone interested?
Happy to share the great news that our second son was born last week. I’m amazed by this young and beautiful new life, as well as the strength of my wife during delivery. There’ll be some more time off the next weeks btw, we’re thoroughly enjoying our family time!