In the realm of modern data handling, Elasticsearch has emerged as a powerhouse, offering rapid data search and analysis.
As a PHP developer, integrating this robust search engine into your projects can elevate your data operations to new heights. In this article, we'll illustrate a concise example of how to create an index, create a document, get a document, and search for documents using PHP's cURL library.
The following examples will empower you to efficiently store, retrieve, and manipulate data through Elasticsearch's RESTful API, all within the familiar PHP environment.
26 August, 2023 by Yoan Arnaudov
• Category: Symfony
I've decided to test the performance of two popular PHP frameworks - Laravel and Symfony. The results surprised me.
The performance test which I've conducted is quite simple. I've created two projects in Symfony and Laravel with only one page, no database queries, no API calls, and no complex calculations, just one simple page. Then I ran HTTP stress tests using a benchmarking tool against both setups and the results are surprising.
Did you know that Laravel uses a lot of Symfony components under the hood?
Symfony is known for making really good components used across the whole PHP ecosystem in numerous packages. Most of the Symfony components can be used as a standalone package without the need for Symfony itself, which is quite handy.
For example, the laravel/framework packages uses 11 Symfony components (at the time of writing this post), some of which are symfony/routing, symfony/mailer, symfony/http-foundation etc.
Have you ever wondered if Apache mod-php is faster than php-fpm with Nginx? I surely did.
Each time this question arises, I do a quick research, and I cannot seem to find a definitive answer. It seems that the recommended way to run PHP websites nowadays is to use php-fpm with Nginx, but is that the best method? Some articles state that php-fpm is 300% faster than mod-php, other articles state that mod-php is faster, and so on.
This is why I've decided to conduct my own tests and performance benchmark and settle this debate once and for all.
22 August, 2023 by Yoan Arnaudov
• Category: Symfony
In Symfony, the Doctrine Query Builder provides a convenient and object-oriented way to construct complex SQL queries. The where() method is used within the Query Builder to add conditions to your queries. Here's how you can use it: