DEV Community

Cover image for Symfony Station Communiqué - 21 January 2022. A Look at Symfony and PHP News.
Reuben Walker, Jr.
Reuben Walker, Jr.

Posted on • Edited on

Symfony Station Communiqué - 21 January 2022. A Look at Symfony and PHP News.

This post originally appeared on Symfony Station.

Welcome to this week's extensive Symfony Station Communiqué. It's your weekly review of the most valuable and essential news in the Symfony and PHP development communities. Take your time and enjoy the items most valuable for you.

Thanks to Javier Eguiluz and Symfony for sharing our last communiqué and newest article in their Week of Symfony.

*Please note that links will open in a new browser window. My opinions, if I present any, will be in bold.

Symfony

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."

A Week of Symfony #785 (10-16 January 2022) https://symfony.com/blog/a-week-of-symfony-785-10-16-january-2022

Symfony announced "Today, 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.

Introducing the Symfony 6 Certification https://symfony.com/blog/introducing-the-symfony-6-certification

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."

A better way to quickly start Symfony projects https://symfony.com/blog/a-better-way-to-quickly-start-symfony-projects

Featured Item graphic

Featured Item

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.

Fast, Smart Flex Recipe Upgrades with recipes:update

This Week

Akashic Seer is back with another entertaining article.

Symfony how to get query string values sent by AJAX calls https://akashicseer.com/web-development/symfony-how-to-get-query-string-values-sent-by-ajax-calls/

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. "

A Little Sylius Adventure: From the perspective of a Magento developer. https://oliverde8.medium.com/a-little-sylius-adventure-f9e9c96f6b23

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. "

Case Study: Rapid-flyer.com x Les-Tilleuls.coop (en francais) https://les-tilleuls.coop/blog/etude-de-cas-rapid-flyer-com

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."

How to Disable Certain Listeners during Certain Commands in Symfony (en Francais) https://www.prestaconcept.net/blog/symfony/comment-desactiver-certains-listeners-lors-de-certaines-commandes

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.)

New in EasyAdmin 4: Menu Badges https://easycorp.github.io/blog/posts/new-in-easyadmin-4-menu-badges

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!"

JSON Columns and Doctrine DBAL 3 Upgrade https://dunglas.fr/2022/01/json-columns-and-doctrine-dbal-3-upgrade/

Luismi Sánchez shares his Tips and notes from a SymfonyCast.

Symfony fundamentals notes https://luismi.sanchezarteaga.es/symfony-fundamentals-notes/

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."

Laradock - a ready to use PHP docker environment https://dev.to/quentindamianino/laradock-ready-to-use-php-docker-environment-320e

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.

4 ways to inject dependencies in Symfony that you probably don’t know about https://medium.com/@OCharnyshevich/4-ways-to-inject-dependencies-in-symfony-that-you-probably-dont-know-about-65e8efe02af5

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."

How to integrate TailwindCSS v3 into a Symfony project with Webpack Encore (en francais) https://www.yourigalescot.com/fr/blog/comment-integrer-tailwindcss-v3-a-un-projet-symfony-avec-webpack-encore

PHPStan is being added to core for the Drupal 10 update later this year.

The static analyzer tool PHPStan has been added to Drupal Core. https://www.drupal.org/node/3258232

For those of you using Drupal for your site, this looks like a useful module.

Personalizing the Website Experience for Visitors Using the Drupal 9 Smart Content Module. https://www.specbee.com/blogs/personalizing-website-experience-using-drupal-9-smart-content-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."

Permissions updates in Drupal 9.3 https://www.webomelette.com/permissions-updates-drupal-9.3

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."

Implementing Strategy Pattern with Symfony https://q.agency/blog/implementing-strategy-pattern-with-symfony-showcase

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."

Store Secrets in Vault with Symfony
https://dev.to/gromnan/store-secrets-in-vault-with-symfony-51ai

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."

A better error page for Symfony applications https://freek.dev/2169-a-better-error-page-for-symfony-applications

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."

Consuming External APIs: basic tips & tricks https://netgen.io/blog/consuming-external-apis-basic-tips-tricks

Timeless

Inspector logo

Sponsored Article

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.

Why You Should Use Code Execution Monitoring with Symfony

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.

PHP logo

PHP

This Week

In this well-written article, Ibrahim Alausa shows us how to future-proof our controllers.

A comprehensive guide on how to design future-proof controllers: Part 1 https://worldclassibro.hashnode.dev/a-comprehensive-guide-on-how-to-design-future-proof-controllers-part-1

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."

Deploy Redis as a Docker container [part 1] https://dev.to/hojjat12/deploy-redis-as-a-docker-container-part-1-5c48

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."

Developer Quick Start: PHP and MariaDB https://dev.to/probablyrealrob/developer-quickstart-php-and-mariadb-e3g

Last week, we shared Eric the Coder's article on Modern PHP. He adds to the series with a few new posts.

PHP crash course : Strings and Numbers https://dev.to/ericchapman/php-crash-course-strings-and-numbers-40i0

Yactouat finishes his series on PHP iterators and generators.

Introducing PHP custom collections with the IteratorAggregate\ interface https://dev.to/yactouat/introducing-php-custom-collections-with-the-iteratoraggregate-interface-1469

Backend Developer reviews the read-only property for us.

Php 8.1 New Features — Read-only Properties https://kvnc-inc.medium.com/php-8-1-new-features-readonly-properties-9994fdffd594

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."

Improve quality of PHP applications with static analysis and SonarQube https://medium.com/docler-engineering/improve-quality-of-php-applications-with-static-analysis-and-sonarqube-eb6d7d52e8db

The following was popular when we shared it on Twitter. Dariusz Gafka shows us:

How To Integrate Micro-services https://blog.devgenius.io/how-to-integrate-microservices-a506fe2d1a48

He continues with:

Starting with Micro-services in PHP https://medium.com/nerd-for-tech/starting-with-microservices-in-php-6e3c411f3d27

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."

Dealing with Dependencies https://stitcher.io/blog/dealing-with-dependencies

A new issue of PHP [Architect] is out and features Domain Driven Design.

The January edition of PHP [Architect] is out. https://www.phparch.com/magazine/2022/01/domain-driven-resolutions/

Kristian Lentino shares his exploration of Rabbit MQ.

Trying out Rabbit MQ
https://dev.to/kristianlentino99/trying-out-rabbitmq-2goh

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."

Reliable event dispatching using a transactional outbox https://blog.frankdejonge.nl/reliable-event-dispatching-using-a-transactional-outbox/

Ajimoti Ibk show us how to:

Calculate PHP cache time with ease https://medium.com/@ajimotiajbkibk/calculate-php-cache-time-with-ease-d3805fa1c46e

Last Week

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.

Pre-commit 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.

Automation — PHP Code Formatting before (pre) git commit https://blog.canopas.com/automation-php-code-formatting-before-pre-git-commit-ce23c43586b0

Last Month

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.

Overriding vendor classes in a Composer Dependency https://downing.tech/posts/overriding-vendor-classes

Timeless

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."

5 PHP Date Functions and Their MySQL Equivalents https://levelup.gitconnected.com/5-php-date-functions-and-their-mysql-equivalents-a70c208e4d13

Code logo

Other

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.

Easy Docker Tunnel for the win https://medium.com/@dotcom.software/easy-docker-tunnel-for-the-win-a913436b403f

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".

Open-source creates value, but how do you measure it? https://github.blog/2022-01-20-open-source-creates-value-but-how-do-you-measure-it/

Jeff Geerling shares his strategy for avoiding burnout as a maintainer for multiple projects.

The burden of an Open-Source maintainer https://www.jeffgeerling.com/blog/2022/burden-open-source-maintainer

The Next Web notes "Just because you're OSS doesn't mean you have to be strapped for cash all the time."

6 ways open-source devs can make money https://thenextweb.com/news/6-ways-open-source-devs-can-make-money-syndication

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."

For security alone, we could try paying open-source projects properly https://www.zdnet.com/article/for-security-alone-we-could-try-paying-open-source-projects-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. "

On Open-Source and Importance of The PHP Foundation https://shawnhooper.ca/2022/01/16/php-foundation-open-source/

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."

Open-source developers, who work for free, are discovering they have power
https://techcrunch.com/2022/01/18/open-source-developers-who-work-for-free-are-discovering-they-have-power/

Tara Prasad Routray wants to help us "learn about the incredible new features that ship with the Tailwind CSS v3.0 release."

Top 10 Features Introduced in Tailwind CSS v3.0 https://levelup.gitconnected.com/top-10-features-introduced-in-tailwind-css-v3-0-39f9700b12a1

Christoph Nißle's article is a well-done overview of the scattered nature of IT landscapes and the challenges they face.

Why you should decide to do API Management https://medium.com/@christophnissle/why-you-should-decide-to-do-api-management-bbc651269b69

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!

Reuben Walker

Founder Symfony Station

Reuben is also Ringmaster of Mobile Atom Media and its division Mobile Atom Code.

Top comments (1)

Collapse
 
philosoft profile image
Alexander Frolov

Deploy Redis as a Docker container [part 1]
Trying out Rabbit MQ

Both of these are terrible. Please do not put such stuff on a list.

Redis one can be boiled down to 2 lines

  1. docker run --name my-redis -p 6379:6379 -d redis
  2. use my cool new wrapper service on top of AWS to forget about Ops

No useful information whatsoever, nothing explained about reds, docker, tags, names, ports (+ there is a mistake about port numbers), no configuration, no php, no deployment of any kind.

RabbitMQ one is no better. Code is in small screenshots instead of text. Nothing about php extension or composer library, no context, code samples basically taken from rabbitmq.com/tutorials/tutorial-on... (which by the way is much more comprehensive, illustrative and easier to follow)