Null: A value (or the absence of a value) representing "nothing here". Accessing a property of null when you expect an object is one of the most common runtime errors. Null represents the absence of a value: no middle name, no delivery date yet, no customer linked. Many languages have it, under names like null, nil or None.
It is also one of the most common sources of runtime errors. Code expects an object, receives null, and crashes when it calls a method on it. Its inventor, Tony Hoare, called it his "billion-dollar mistake".
What should you keep in mind with Null?
Modern tools help. PHP has nullable types like ?string, the null-safe operator ?-> and the null coalescing operator ??. Static analysis with PHPStan warns when a value might be null. Decide deliberately where null is allowed, in your database columns as well as in your code. A clear rule, such as required fields being NOT NULL, removes many checks and many bugs.
Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.