Type Parameter: A placeholder type, conventionally T, filled in when the generic is used, e.g. Array, Box. A type parameter is a placeholder for a type in generic code, usually written T. Collection<T> means a collection of some type that is chosen when you use it, so Collection<User> holds users and Collection<Order> holds orders.
The code is written once, and the compiler or static analyser checks each use with the actual type filled in. Methods like first() then know they return a User or an Order, not just "something".
What should you keep in mind with Type Parameter?
In TypeScript, Java and C#, type parameters are part of the language. In PHP, you write them in docblocks with @template T, and PHPStan or Psalm check them. Laravel's own code is annotated this way, which is why your editor knows what an Eloquent query returns. Constraints like T extends Model limit which types are allowed.
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.