Encapsulation

Encapsulation is the practice of bundling data, in properties, and methods that operate on that data into a single unit, a class, while restricting direct access to some of the object’s components.

Encapsulation relies mostly on classes and visibility, to control access to data.

This is a fundamental principle of OOP, promoting security, modularity, and maintainability.

See also Encapsulation in PHP with Example and mastering encapsulation in php: getters, setters, and access modifiers demystified.

Related : OOP (Object Oriented Programming), Class Getter Method, Class Setter Method, Service Container, Service

Related packages : paragonie/hidden-string