socialconnect / common
Common library
Installs: 224 312
Dependents: 6
Suggesters: 0
Security: 0
Stars: 6
Watchers: 5
Forks: 3
Open Issues: 0
Requires
- php: >=7.1
- psr/simple-cache: ^1.0
README
Build Client
for your REST application
use SocialConnect\Common\ClientAbstract; class MySocialNetworkClient extends ClientAbstract { public function requestMethod($method, $parameters) { //... } public function getUser($id) { $result = $this->requestMethod('/user/get/', $id); if ($result) { $user = new User(); $user->id = $result->id; //... return $user; } return false; } }
Next you can use it
$client = new MySocialNetworkClient($appId, $appSecret); // You can use any client that implements Psr\Http\Client\ClientInterface $client->setHttpClient(new \SocialConnect\HttpClient\Curl()); $user = $client->getUser(1); //Custom rest methods $client->requestMethod('myTestMethod', []); $client->requestMethod('myTest', []);