The solution is to create a new class that extends it from your library, and then use your class that has all the methods of the source, plus yours.
Here is an example (very quick and simple):
class YourClass extends TheLibraryClass { public function yourNewMethod() {
And then you use your class:
$obj = new YourClass(); $obj->yourNewMethod();
And you can call methods of the TheLibraryClass class, since yours inherit the properties and methods of this:
$obj->aMethodFromTheLibrary();
You can find this in the Object Inheritance section of the manual.
And, you guessed it, changing the library is definitely a bad idea: you will have to repeat this modification every time you update the library!
(One day or another you will forget - or one of your colleagues will forget ^^)
source share