public — accessible from anywhereprotected — class and subclasses onlyprivate — class only (strictest)readonly (PHP 8.1+) — can only be written in the constructorA class can change its internal implementation without affecting external code. Example: changed balance storage from int to a Money VO — external code is unaware because it only calls getBalance().
Not mandatory — they are an implementation detail. Duplicating a field $name with a getter getName() for no reason violates DRY. Expose only what external code genuinely needs.