Goodbye controllers, hello request handlers
A lot has changed in the PHP landscape over the past years. We started using more design patterns and things like the DRY and SOLID principles. But why are we still using controllers?
A lot has changed in the PHP landscape over the past years. We started using more design patterns and things like the DRY and SOLID principles. But why are we still using controllers?
ββElegant background jobs in PHP
For a long time, I was looking for some elegant solutions to create and run background jobs in PHP.
I joined a company which used Laravel massively and Laravel ships with an awesome Queue system. Suddenly, I forgot how tedious and troublesome it used to be for me to write queues in PHP.
For a long time, I was looking for some elegant solutions to create and run background jobs in PHP.
I joined a company which used Laravel massively and Laravel ships with an awesome Queue system. Suddenly, I forgot how tedious and troublesome it used to be for me to write queues in PHP.
ββSymfony Console Beyond the Basics β Helpers and Other Tools
Itβs undeniable how useful console commands can be when developing software. Not too long ago we re-introduced the Symfony Console component.
Itβs undeniable how useful console commands can be when developing software. Not too long ago we re-introduced the Symfony Console component.
ββProoph: CQRS+ES in PHP. How to use.
Pattern CQRS and Event Sourcing become more and more popular every day in PHP community. You can easily find lot libraries to store events, to execute commands, to manage repositories, etc. The leader there doesnβt exist yet, but prooph as the most complex solution is close to that position. They have only one problem, documentation.
Pattern CQRS and Event Sourcing become more and more popular every day in PHP community. You can easily find lot libraries to store events, to execute commands, to manage repositories, etc. The leader there doesnβt exist yet, but prooph as the most complex solution is close to that position. They have only one problem, documentation.
ββProperly passing data from outer layers of a PHP application to the use case layer
Lately, I've been digging a lot in different ways of improving software architecture. Mainly subjects like Clean Architecture, Domain Driven Design, and such.
Lately, I've been digging a lot in different ways of improving software architecture. Mainly subjects like Clean Architecture, Domain Driven Design, and such.
Injectables vs. Newables
Many projects I join - even those that claim to already do dependency injection - suffer from issues that result from mixing injectable and newable classes. Keeping these two appart seems to be challenging for many developers so that I try to give them a handy guide with Do's and Dont's in this blog post.
Many projects I join - even those that claim to already do dependency injection - suffer from issues that result from mixing injectable and newable classes. Keeping these two appart seems to be challenging for many developers so that I try to give them a handy guide with Do's and Dont's in this blog post.
ββHow to Optimize MySQL: Indexes, Slow Queries, Configuration
MySQL is still the worldβs most popular relational database, and yet, itβs still the most unoptimized β many people leave it at default values, not bothering to investigate further. In this article, weβll look at some MySQL optimization tips weβve covered previously, and combine them with novelties that came out since.
MySQL is still the worldβs most popular relational database, and yet, itβs still the most unoptimized β many people leave it at default values, not bothering to investigate further. In this article, weβll look at some MySQL optimization tips weβve covered previously, and combine them with novelties that came out since.
ββThe Repositories Pattern in Lumen
The repositories pattern is widely used pattern whose main point is that the application does not have to know data is implemented. This makes it easier to switch to another data source or implement structural changes to the existing data source.
The repositories pattern is widely used pattern whose main point is that the application does not have to know data is implemented. This makes it easier to switch to another data source or implement structural changes to the existing data source.
The Magic Behind Async PHP
Async PHP allows a massive speedup of applications by leveraging non-blocking I/O. It allows making multiple HTTP requests in parallel or any other way of I/O multiplexing. But whatβs the magic behind it? How does it actually work?
Async PHP allows a massive speedup of applications by leveraging non-blocking I/O. It allows making multiple HTTP requests in parallel or any other way of I/O multiplexing. But whatβs the magic behind it? How does it actually work?
How to Read Big Files with PHP (Without Killing Your Server)
Itβs not often that we, as PHP developers, need to worry about memory management. The PHP engine does a stellar job of cleaning up after us, and the web server model of short-lived execution contexts means even the sloppiest code has no long-lasting effects.
Itβs not often that we, as PHP developers, need to worry about memory management. The PHP engine does a stellar job of cleaning up after us, and the web server model of short-lived execution contexts means even the sloppiest code has no long-lasting effects.
Extending ReactPHP's Child Processes Part Two
react/child-process
is very flexible and can work a lot of ways but sometimes you don't want to be bothered with the details of how it works and just want a simpler API to do that.PHP 7.2's "switch" optimisations
PHP 7.2 is around the corner soon, and comes with many optimisations. Many new optimisations are implemented in opcache, but some others are implemented in PHP itself. One optimisation that falls in the latter category is an optimisation of the switch/case construct.
PHP 7.2 is around the corner soon, and comes with many optimisations. Many new optimisations are implemented in opcache, but some others are implemented in PHP itself. One optimisation that falls in the latter category is an optimisation of the switch/case construct.
How to Deploy With Deployer
Automated workflow for deployment is a great tool that every software development team must have. The release process, when it is fast, secure and fault tolerant, can save time for developing more great things. And the good news that there are many great tools for creating an automated release cycle.
Automated workflow for deployment is a great tool that every software development team must have. The release process, when it is fast, secure and fault tolerant, can save time for developing more great things. And the good news that there are many great tools for creating an automated release cycle.
PHP 7.2.0 Released
The PHP development team announces the immediate availability of PHP 7.2.0. This release marks the second feature update to the PHP 7 series.
The PHP development team announces the immediate availability of PHP 7.2.0. This release marks the second feature update to the PHP 7 series.
Adding a GraphQL API to your Symfony Flex application
I've been using GraphQL for some API thingamajigs, and it's been working fine. Now with Symfony 4 out, I figured a write-up on how to use GraphQL with Symfony Flex could be useful for someone.
We'll expand on a previous demo app that I built. That app already uses Doctrine ORM as storage, so let's bridge that to a GraphQL API.
I've been using GraphQL for some API thingamajigs, and it's been working fine. Now with Symfony 4 out, I figured a write-up on how to use GraphQL with Symfony Flex could be useful for someone.
We'll expand on a previous demo app that I built. That app already uses Doctrine ORM as storage, so let's bridge that to a GraphQL API.
ββReactPHP PromiseStream: From Promise To Stream And Vice Versa
One of the patterns that are used to deal with streams is spooling: we need the entire resource data available before we start processing it. One approach is to collect each chunk of data received from the stream:
One of the patterns that are used to deal with streams is spooling: we need the entire resource data available before we start processing it. One approach is to collect each chunk of data received from the stream:
PHP-FPM tuning: Using βpm staticβ for Max Performance
Letβs take a very quick look at how best to set up PHP-FPM for high throughput, low latency, and a more stable use of CPU and memory. By default, most setups have PHP-FPMβs PM (process manager) string set to dynamic and thereβs also the common advice to use ondemand if you suffer from available memory issues.
Letβs take a very quick look at how best to set up PHP-FPM for high throughput, low latency, and a more stable use of CPU and memory. By default, most setups have PHP-FPMβs PM (process manager) string set to dynamic and thereβs also the common advice to use ondemand if you suffer from available memory issues.
Case Study: Optimizing CommonMark Markdown Parser with Blackfire.io
This last goal is perhaps the most challenging, especially from a performance perspective. Other popular Markdown parsers are built using single classes with massive regex functions. As you can see from this benchmark, it makes them lightning fast:
This last goal is perhaps the most challenging, especially from a performance perspective. Other popular Markdown parsers are built using single classes with massive regex functions. As you can see from this benchmark, it makes them lightning fast: