Welcome to this week's Symfony Station Communiqué. It's your weekly review of the most essential news in the Symfony and PHP development communities. Take your time and enjoy the items most valuable for you.
*Please note that links will open in a new browser window. My opinions, if I present any, will be in bold.
As always, we will start with the official news from Symfony.
Highlight -> "This week, Symfony fixed some issues related to PHP enums and improved the performance when using many environment variables in your application. Meanwhile, the SymfonyWorld Online 2022 Summer Edition conference finished its early bird period, but the Call for Papers is still open, so you can send your proposals until February 14, 2022."
Symfony announced "we're introducing the new certification exam for Symfony 6. This exam is similar to the existing Symfony certification exams (same exam topics, same number of questions, etc.) but we've revamped the certification contents with many new questions in addition to removing outdated or complicated questions. We've also updated the content so the entire certification exam for Symfony 6 is much easier than before. No trick questions, the entire exam has been redesigned making sure all questions will be easy to understand and easy to answer to."
They introduced the brand new Webapp pack. "What are the benefits? The main benefit is that a pack is a regular Composer package that you can require in any existing project (even late in the game). That allows to compose your application by using more than one pack. As for code, package composition is almost always better than inheritance. The website skeleton is all about inheritance: philosophically, it extends the base skeleton. You need to use one or the other. On the contrary, the Webapp pack can be included in any set of dependencies, independently of the skeleton that was used to create the project. Think of a pack as being the equivalent of a PHP trait."
Symfony Flex makes it easy to install a package and get everything you need to start working immediately: new config files, changes to .env, Docker configuration and more. The idea is so powerful that symfony/skeleton - the repository used for new Symfony apps - starts empty other than composer.json! Familiar files like src/Kernel.php, bin/console and config/services.yaml are added to your project via recipes.
Starting in symfony/flex 1.18.0 or 2.1.0, a new composer command is now available when you need to update Symfony to a new version: recipes:update. This command is smart: it generates a "diff" between the originally-installed version of recipe and the latest version, then leverages git to apply that patch. In other words, upgrading recipes is as simple and robust as merging two branches together with git! Most of the time the changes apply cleanly. But if they don't, you get a familiar git-style conflict that you can resolve.
Akashic Seer is back with another entertaining article.
Oliver de Cramer writes "For over 7 years I have mostly worked on e-commerce projects. Most of them were Magento 1 & 2 projects with a few adventures with other solutions (Drupal commerce 😱).
So when beginning of this summer I was given the opportunity to work on a Sylius project that didn’t sell products, but subscriptions I jumped on the occasion. "
Speaking of Sylius, Les-Tilleuls.coop has a case study carried out with one of its customers, Rapid-flyer.com.
They say "in this article, we go to meet Nicolas Mathieu, CEO of this company founded almost 20 years ago, who looks back on the different technical choices that led to our collaboration and the current development of this e-commerce project. "
PrestaConcept presents "a simple and elegant solution, using the injection of tagged services, to give you the possibility to disable certain listeners when executing certain commands."
EasyAdmin 4.0.2 has been released, and it includes one of the most requested features by the community: menu badges. These badges are commonly used to display some numeric value next to menu items (e.g. number of notifications, number of new clients, number of invoices pending to be paid, etc.)
Kévin Dunglas says "version 3 of the popular Doctrine DBAL library has been released at the end of 2020, almost 10 years after the initial release of version 2. In September 2021, Doctrine ORM 2.10 added support for DBAL 3, while still supporting DBAL 2 at the same time.
The upgrade process from DBAL 2 to DBAL 3 is usually straightforward. Most breaking changes impact low-level classes, that aren’t commonly directly manipulated when using the ORM. However, things become more complex if you rely on JSON columns, and you may know that I’m a big user of them!"
Luismi Sánchez shares his Tips and notes from a SymfonyCast.
Damian Brdej writes "Laradock is a full PHP development environment for Docker. It contains a variety of popular services such as PostgreSQL, MySQL, Redis, MongoDB, PHPmyAdmin, and so on."
Oleg Charnyshevich tells us "one part of my job is a code review, and I started to notice that some of my colleagues can’t get an idea of dependency injection and the service container. As a result, they tend to over-engineering things." He continues with this.
Youri Galescot says "some time ago I discovered the TailwindCSS framework created by Adam Wathan and I was seduced by its simplicity and speed of use. My productivity in creating user interfaces and HTML/CSS integration has been really boosted."
PHPStan is being added to core for the Drupal 10 update later this year.
For those of you using Drupal for your site, this looks like a useful module.
Finally on the Drupal front, Daniel Sipos writes that in December "the 9.3.0 minor version of Drupal was released, containing, like usual, some progressive enhancements to the overall product. Among these, I would like to highlight today two such changes pertaining the permissions system. So let’s get to it."
Matija Cerovec writes "The strategy design pattern is a behavioral software design pattern that lets you define a family of algorithms, encapsulates them, and selects one from the pool for use during runtime. The algorithms are mutually interchangeable. By using design patterns, you can make your code more flexible, reusable, and maintainable. In this blog, I will show how to use strategy design pattern on Symfony by real-world case."
Jérôme Tamarelle tells us "Integrating Vault and Symfony does not require any PHP code. Using vault-agent secrets variables can be dumped into .env file. Dynamic secrets can even be used as feature flags."
Freek Van der Herten makes the claim "Ignition is the most beautiful error page for PHP apps. Yesterday, we launched a new major version of Ignition - you can check out all the details in this blog post.
Ignition used to be Laravel specific, but we've now created a framework-agnostic version as well. Let's try using Ignition in a simple Symfony app."
Leo Hajder asks "How often do you have to consume an external API and integrate it into a Symfony application? Let’s see how to do it fast and/or well, and hopefully learn something along the way. For this example, we’re going to take a look at how to get a response from an API endpoint and render the data in a twig template."
We published our first sponsored article on Symfony Station exploring how Code Execution Monitoring helps you identify bugs and bottlenecks in your Symfony app before your customers do. Like all our articles it is now available via audio.
All sponsored articles are for products we have vetted and stand behind. We either use them or would do so if they were applicable to the Symfony Station site.
In this well-written article, Ibrahim Alausa shows us how to future-proof our controllers.
Hojjat has another introductory post for us and states "in this guide, we’ll use Docker to quickly deploy Redis using the official image on Docker Hub."
Rob Hedgpeth says "The PHP programming language has long been considered a fairly light and simple solution for developers to use to create robust and creative web applications. In fact, that’s as true now as it has ever been as past few versions of PHP have made the language more appealing than ever.
Like many other languages, PHP has the ability to take advantage of the power of MariaDB, and it’s actually a pretty simple and straightforward process."
Last week, we shared Eric the Coder's article on Modern PHP. He adds to the series with a few new posts.
Yactouat finishes his series on PHP iterators and generators.
Backend Developer reviews the read-only property for us.
Dolcer Engineering asks "have you ever worked on micro-services architecture with a lots of services where every one of them is created by different team and with different code standards? Situations like that are never ideal, but sometimes there’s no other choice, and you need to improve what you can. This was the exact problem we encountered."
The following was popular when we shared it on Twitter. Dariusz Gafka shows us:
He continues with:
Brent at Stitcher.io writes "I want to share some actionable advice on how to deal with updating external dependencies. Because, let's face it, you want to update your project to PHP 8.1, but some of your dependencies don't support it. So, end of story, right?
Here's what I do in such cases."
A new issue of PHP [Architect] is out and features Domain Driven Design.
Kristian Lentino shares his exploration of Rabbit MQ.
Frank de Jonge says "using events in a system is great, but how do you know for sure if you've reliably dispatched your events? The transportation of events needs to be done reliably while maintaining overall system consistency, be it eventual or immediately. In a typical setup, a database is used to store information and queues are used to send messages between processes and systems. Often, the events are dispatched directly to the queue in the same action that stores information in the data. This may not seem to be obviously wrong, but there is a potential problem with this approach."
Ajimoti Ibk show us how to:
Git hooks are scripts that will run when a certain event occurs in git like git push, git pull, git commit, etc. We can find git hooks at .git/hooks in a particular git repository.
Precommit is a git hook, that triggers custom scripts or commands during the execution of a git commit.
In this article, we will format PHP code using prettier at a time of committing code to git.
Ever found yourself wanting to make a small tweak to a PHP file in a Composer dependency? Here's how to do it without forking the entire package.
Joshua Otwell writes "If you’re a PHP/MySQL Developer, you have date function options for both the database and your programming language of choice. In this post, I cover 5 PHP date functions and their (somewhat) MySQL equivalents with examples of each."
About.com Software provides a showcase on how to develop locally with Docker, using a remote database over a secure SSH tunnel. No Docker hacking and no firewall tinkering are required.
Last week, I shared several articles about the challenges of open-source maintenance. This week, I am continuing the theme." As I have said before, if you use an open-source products please contribute to the maintainer(s).
GitHub participated in the White House meeting on open-source cybersecurity. In the post they "outline three themes that the GitHub Policy Team thinks should drive this conversation with policymakers—to help open-source prosperity and sustainability. These themes are only a starting point: if you have thoughts, please get in touch."
Jeff Geerling shares his strategy for avoiding burnout as a maintainer for multiple projects.
The Next Web notes "Just because you're OSS doesn't mean you have to be strapped for cash all the time."
ZDNet makes this point "Instead of running around like headless chooks because a widely used piece of open source software is maintained by volunteers and has a massive hole in it, imagine paying someone to look after such software properly."
Shawn Hooper says "The problem is when projects get popular. You now end up with software that is used in thousands (millions?) of pieces of software that is at risk of a) its developer either abandoning the project due to new interests, changed life priorities or 2) the employer who was paying for the development work ends the project. "
Finally, TechCrunch notes "Most people don’t realize it, but many of the devices and apps you use every day are built on top of open-source software, maintained by one or two developers that aren’t paid for their time, who patch bugs and improve their code to give back to the community or as a passion project."
Tara Prasad Routray wants to help us "learn about the incredible new features that ship with the Tailwind CSS v3.0 release."
Christoph Nißle's article is a well-done overview of the scattered nature of IT landscapes and the challenges they face.
Have you published or seen something related to Symfony or PHP that we missed? If so, please contact us.
That's it for this week. Thanks for making it to the end of another extended edition. I look forward to sharing next week's Symfony and PHP news with you on Friday.
Please share this post. :) Be sure to join our newsletter list at the bottom of our site’s pages. Joining gets you each week's communiqué in your inbox (a day early). And follow us on Twitter at @symfonfystation.
Happy Coding Symfonistas!