I am using the monolith PEAR Auth class on my site for authentication, but recently I've decided that Facebook connect would be ideal as well for my site. I've been on the Facebook dev website which provides examples to integrate Facebook with current classes, but I don't want to modify the PEAR Auth repository I have on my server.
Is there another solution? Should I integrate an开发者_运维技巧other Auth system?
You can easily implement your own Facebook container for PEAR Auth. You do not need to modify PEAR's auth code for that, because it tries to load the authentication container from your include path.
Suppose you have PEAR installed in /usr/share/php/
, and your app in /var/www/myapp/
, you could create a file /var/www/myapp/src/Auth/Container/Facebook.php
. In your app, use
set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/myapp/src/')
to make PEAR Auth recognize your custom container directory. Then you can instantiate a facebook container in Auth
精彩评论