If you would like to add your own library / custom PHP script to Magento, simply copy it to the /lib folder and name it the required way. Place your lib into /lib/MyOwnLib/MyLib.php for example and name the class inside MyLib.php MyOwnLib_MyLib and you are done. The class code looks like this:
class MyOwnLib_MyLib {
// ...
}
You can now load the class everywhere using:
$myLib = new MyOwnLib_MyLib();
Adding a custom library / PHP script
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.