PHP Classes

Friendly class: Provide friend access to protected functions

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 58%Total: 625 All time: 5,054 This week: 455Up
Version License PHP version Categories
friendly_class 1.0GNU Lesser Genera...5.0PHP 5, Language


This class can be used to provide access to protected or private functions from friend classes.

It is a base class that provides alternative methods prefixed with the name friend_ .

When a function is called with that prefix, the base class calls the function with the name after the prefix, if it is considered a friend method.

Innovation Award
PHP Programming Innovation award nominee
August 2008
Number 3

Prize: One book of choice by Packt
Certain packages consist of multiple classes that are used in cooperation. Such classes usually need to access each other protected variables or functions.

In other languages there are friend classes like in C++ or package classes like in Java that allow restricting the access to variables of functions to cooperating classes.

Even with the enhancements of version 5 object model, there is no PHP support to this concept similar to C++ friend or Java package classes.

This class provides an emulation of such concept that works under PHP 5.

Manuel Lemos
Picture of Rubens Takiguti Ribeiro
Name: Rubens Takiguti Ribeiro is available for providing paid consulting. Contact Rubens Takiguti Ribeiro .
Classes: 7 packages by
Country: Brazil Brazil
Age: 40
All time rank: 63747 in Brazil Brazil
Week rank: 71 Up4 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 3x

  Files folder image Files  
File Role Description
Plain text file friendly_class.class.php Class Main class
Plain text file doc.php Doc. Documentation
Accessible without login Plain text file example.php Example Simple example
Plain text file LICENSE.TXT Lic. License

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,054
This week:455Up
 User Ratings  
 All time