Articles

The source of programming articles

How to Get a PHP Enum Case from Its Value
php
August 26, 2026 1 minutes reading time

How to Get a PHP Enum Case from Its Value

PHP enums provide a clean way to represent a fixed set of possible values. When working with a backed enum, each enum case has an associated scalar value, such as a string or integer. A common situation is receiving a value from a database, API request, form, or another external source and needing to retrieve […]

PHP Object References: How to Use & References
php
August 16, 2026 1 minutes reading time

PHP Object References: How to Use & References

In PHP, you can create a reference to a variable using the & operator. A reference means that two variables point to the same value, so changing one variable can also affect the other. Here is an example of creating reference in PHP. In the code below $b is a reference to $a, means if […]

How To Remove a String Prefix Easily In Laravel
laravel
August 10, 2026 1 minutes reading time

How To Remove a String Prefix Easily In Laravel

Laravel provides many useful string helpers through the Illuminate\Support\Str class. One of them is Str::chopStart(), which makes it easy to remove a specific string from the beginning of another string. It is especially useful when working with prefixes such as URL paths, file names, namespaces, or other formatted strings. # What Is Str::chopStart() in Laravel? […]

How to Fix Git Detecting chmod Permission Changes on Linux
programming
August 1, 2026 1 minutes reading time

How to Fix Git Detecting chmod Permission Changes on Linux

Have you ever run chmod on a folder or file in Linux, only to open git status and see a long list of modified files, even though you didn’t change a single line of code? This is a common frustration for developers working with any project on Linux. Git is tracking file permission changes (the […]

Does Laravel Handle SQL Injection?
laravel
July 19, 2026 2 minutes reading time

Does Laravel Handle SQL Injection?

SQL injection is one of the oldest and most dangerous security vulnerabilities in web applications. If you’re building applications with Laravel, you may wonder: Does Laravel automatically protect against SQL injection, or do I need to implement additional security measures? The short answer is yes Laravel provides strong built-in protection against SQL injection when you […]

PHP final classes
php
July 13, 2026 2 minutes reading time

PHP final classes

Object-oriented programming in PHP gives developers powerful inheritance features. However, not every class is designed to be extended. That’s where the final keyword comes in. A final class explicitly tells PHP that this class cannot be inherited. It protects the class from being extended and helps preserve its intended behavior. When you declare a class […]

Laravel #[CurrentUser] Attribute
laravel
July 7, 2026 1 minutes reading time

Laravel #[CurrentUser] Attribute

Starting with Laravel 12, Laravel introduced the #[CurrentUser] attribute, making it easier to access the authenticated user inside controller methods. Instead of retrieving the user manually using Request object or auth() helper, you can now ask Laravel to inject the authenticated user directly into your method. This results in cleaner, more readable controller code while […]

GitHub Template Repositories: Reuse Your Starter Kit for Every New Project
programming
July 2, 2026 1 minutes reading time

GitHub Template Repositories: Reuse Your Starter Kit for Every New Project

If you frequently start new projects, you’ve probably found yourself copying an existing project over and over again.Maybe you have a Laravel starter kit, a Node.js boilerplate, a PHP project structure, or simply a repository containing your preferred folders, configurations, and development tools. Instead of cloning a project and cleaning it up every time, GitHub […]

Laravel $this->columnName vs $this->attributes[‘columnName’]
laravel
June 21, 2026 1 minutes reading time

Laravel $this->columnName vs $this->attributes[‘columnName’]

When working with Eloquent models in Laravel, you may have seen both of these approaches used to access model attributes: Although they may seem identical, they behave differently under the hood. Understanding the difference is especially important when creating custom accessors, mutators, casts, and model attributes. # Quick Answer The main difference is $this->columnName passes […]

Important Point When Defining Laravel Listener Order
laravel
June 17, 2026 1 minutes reading time

Important Point When Defining Laravel Listener Order

Laravel’s event system is one of the framework’s most powerful features. However, there is a subtle issue that can cause your event listeners to execute twice when you manually define listener execution order in your EventServiceProvider. If you’ve ever noticed duplicate emails, repeated notifications, or the same logic running twice, this might be the reason. […]