Demystifying Value Objects in PHPValue Objects are simple PHP classes that allow us to compare the values of an entity that could be in different formats. For example, money could be in multiple currencies, and it cannot be directly compared with just an amount. Let’s dive right int...Oct 7, 2024 · 1 min readblog.mayankjani.com
Data Transfer Objects (DTOs) in PHPLets say, we have a news website and we want to display news which are nearby to the user. First we need to get the user’s location via an API and then pass it to the database query. We can use the API from https://ip-api.com class IpApi{ public ...Sep 13, 2024 · 4 min readblog.mayankjani.com
How to reuse database queries in LaravelOften in database heavy applications in Laravel, we have numerous database queries to fetch various types of data. You might use them in controllers, services, console commands, admins, and other pieces of code. Often these queries are not organized ...Sep 11, 2024 · 3 min readblog.mayankjani.com