Web lists-archives.com

[PHP] Prevent users of library from using internal classes




How can I prevent users of a PHP library from using classes defined in the
library which are not supposed to be used outside of it?

It would be nice if PHP had some concept of package or namespace
visibility, so I could create private classes, but it doesn't.

The only thing I can think of is to put all the internal classes in a
dedicated sub-namespace like \Vendor\Project\_Internal\Class, to make it
obvious.

Is there a better approach?

Thanks