PHPStan has only supported invariant and covariant template types because they are so prevalent in real-world applications. But contravariant template types also have their use cases, and the latest release of PHPStan adds support for them, among other small improvements to generics.
In my recent post, I've introduced a PHPStan extension that brings support for sealed classes and interfaces to statically analyzed PHP. Looking back, I feel I haven't stressed the main benefit enough, so here I am doing it justice.
Sealed classes are a useful feature of Kotlin: they allow you to specify which classes are allowed to extend a sealed class (or implement a sealed interface). With the recently released PHPStan 1.9.0, you can now introduce sealed classes to your PHP codebase too!
Previously, I've discussed working with date and time values both server- and client-side, and I've covered storing temporal data in databases. This time, we're going to talk about telling time.
I've already talked about working with date and time values on both sides of the web stack. However, in web development, we not only manipulate temporal values, we often need to store them somewhere and retrieve them later. This post discusses the best methods of persisting dates and times in databases.
I've talked about date and time not being easy in PHP, and it's not easier in JavaScript either. Luckily, similarly to the PHP ecosystem, the community has provided better solutions to date and time than the native Date. Let's discuss them.
Date
Time is omnipresent in software development. Pretty much every web application works with it in one way or another. Even the simplest blogging platform stores "when" a post should be published and then displays and sorts them using that information. While you might not run into any issues when developing a blogging platform, any more complex system can easily expose how complicated time actually is. Because time is complicated. And yet, many standard libraries in programming languages only give us a limited arsenal to tackle it.
I love Nette Framework's dependency injection solution. I really do. This post is here to share this passion, explaining why I think it is the best DI solution in today's PHP ecosystem.
If you are developing a library that needs to make HTTP requests, here's how not to make it difficult for your consumers.
If you've ever implemented an HTTP API in PHP, you probably know that there's one thing you have to do over and over and over: parse the request body and validate the resulting structure. Now that we have PSR-15, let's use a middleware for that!
I am a full-stack web developer from Brno, Czech Republic. I contribute to open-source projects, write a technical blog, and speak at meetups and conferences.