Pergunta
É possível criar pacotes de classes relacionadas e têm os mesmos protected
e private
campos que são visíveis apenas para as classes de dentro do mesmo pacote?
Basicamente, o mesmo tipo de pacotes como o Java tem. É possível?
Solução
Right now, there is no concept of package.
However, PHP 5.3 is going to introduce namespaces. I'm not sure about how that will affect visibility between classes.
Outras dicas
Nope. PHP has no package or friend-class support.
You might be interested to read http://philsturgeon.co.uk/blog/2012/03/packages-the-way-forward-for-php
Short answer - http://getcomposer.org/
Here are two approaches I've stumbled upon pondering the same issue:
PHP Package Management and Autoloading
And it looks like there are some more import analogs in the PHP require_once() docs. Hope it helps someone going forward.