twitteroauth is the first PHP Library to support OAuth for Twitter’s REST API. It is developed by Abraham Williams. You can download the source code @ GitHub and the example inside is quite easy to follow.
GitHub – abraham / twitteroauth
Unlike the Facebook API, the Twitter API does not support logout. If you want to increase the security, you can force user login every time when he/she clicks the Signin with Twitter button. This can be down by adding the force_login parameter in the GET oauth/authenticate request.
Twitter API – GET oauth/authenticate
Append the force_login parameter in the getAuthorizeURL() function.
...
/**
* Get the authorize URL
*
* @returns a string
*/
function getAuthorizeURL($token, $sign_in_with_twitter = TRUE) {
if (is_array($token)) {
$token = $token['oauth_token'];
}
if (empty($sign_in_with_twitter)) {
//return $this->authorizeURL() . "?oauth_token={$token}";
return $this->authorizeURL() . "?oauth_token={$token}" . "&force_login=true";
} else {
//return $this->authenticateURL() . "?oauth_token={$token}";
return $this->authenticateURL() . "?oauth_token={$token}" . "&force_login=true";
}
}
...
Thanks Abraham Williams for his work on twitteroauth.
Done =)
Reference:

Thanks for the solution.But could you come out with a possible solution for this problem:When a visitor logs out from the website via Twitter, he is not logged out from twitter website itself. This phenomena doesnt occur in other Oauth Social Logins.Your feedback would benefit not only me but million developers.
LikeLike
Not sure how to do that. You’d better ask the author at the project page.
LikeLike