MJMayank Janiinblog.mayankjani.com·Oct 7, 2024 · 1 min readDemystifying 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...00
MJMayank Janiinblog.mayankjani.com·Sep 13, 2024 · 4 min readData 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 ...00
MJMayank Janiinblog.mayankjani.com·Sep 11, 2024 · 3 min readHow 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 ...00