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:

You can now load the class everywhere using:

Adding a custom library / PHP script
You want or need help implementing this solution? Maybe you did not find what you were looking for? Contact me and I will assist you with whatever Magento problem troubles you!