Reasons to use Composition over Inheritance in PHP
August 22, 2019 — In object-oriented programming, there are two ways using which classes can achieve polymorphic behavior: “Inheritance” & “Composition”.
A blog on PHP, JavaScript, and more
August 22, 2019 — In object-oriented programming, there are two ways using which classes can achieve polymorphic behavior: “Inheritance” & “Composition”.
August 13, 2019 — Some of the PHP’s core functions are designed in such a way that they do not handle exceptions in a better way. Instead, they just return false
if there’s any error. This makes developers to handle those error themselves. Take the example below.
August 8, 2019 — There are always multiple ways of doing things. Programming is no different. For instance, in JavaScript, what would you do if you want to get the property of an object running some operation before returning it? Take this example.
August 7, 2019 — The inheritence tree in PHP quickly gets dirty if you’re using mix of static
and non-static
methods into your classes and the inheritence is deeply nested.
August 3, 2019 — To understand, how dependency injection works in Laravel, let’s just get to know what dependency injection actually is, in software engineering.
July 31, 2019 — Have you ever stuck in a situation where the code that you’ve wrote uses foreach to iterate over a set of data into an array and which ultimately caused you to exceed a memory? Well, I’ve been to. Many times.
July 25, 2019 — Recently, I stumbled upon a scenario where I had to extend a class. I'm going to explain what issue I had faced and what's the role of using the grandparent instance of the class to overcome that issue in this article.
July 24, 2019 — Often times comes when you want details related to tax based on the products you currently have anywhere apart from Checkout/Cart page. I’m specifically talking about Magento 2 here. For instance, for one of my projects we’ve a projects page where we use catalog products differently than the Magento’s native way and we needed a way to fetch tax details based on the products we have on that page.
July 12, 2019 — If you want to check if the eloquoent model has certain relationship or not and fetch the results accordingly while querying upon it, you can do this by two approaches in the Laravel Eloquent.