How liliuwei/thinkphp-social works
Project type and purpose
• This is an open-source ThinkPHP extension (“thinkphp-social”) that provides a unified social-login abstraction for ThinkPHP 5.1/6.0.
• It exports two main services:
• Oauth client manager (src/Oauth.php) to handle authorization requests, token exchange, and openid/unionid retrieval.
• User info fetcher (src/GetInfo.php) to retrieve a normalized user profile.
• It supports a configurable set of social-network SDK adapters under src/sdk/ (e.g. QQ, Weixin, Github, Google, etc.).
File structure
• Top level: composer.json, README.md, license, .gitignore.
• src/config/config.php: default package config stub; populated by publishing social.php config.
• Key classes in src/
• Oauth.php – factory + strategy selection + common methods
• GetInfo.php – factory + strategy for user-info retrieval
• src/sdk/: one class per provider implementing the same interface(s).
• No database or frontend assets; this is purely a backend library.
README for additional insights
• Shows how to register routes in ThinkPHP, call Oauth::getInstance($type)->getRequestCodeURL(), then handle callback, fetch access token, fetch user info, and retrieve openid/unionid.
• Emphasizes a plug-and-play set of providers, configured via a single config file.
Detail without overthinking
• Them to show dataflow: config → manager → adapter → API → adapter → data back → controller.