- User
- Friend
You can instance and setup fields for entity
$user = new \SocialConnect\Common\Entity\User();
$user->id = 12345;
$user->firstname = 'Dmitry';
$user->lastname = 'Patsura';
var_dump($user);
You can use Curl
client
$httpClient = new SocialConnect\Common\Http\Client\Curl();
or Guzzle
wrapper for GuzzleHttp library
$httpClient = new SocialConnect\Common\Http\Client\Guzzle();
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);
$client->setHttpClient(new SocialConnect\Common\Http\Client\Curl());
$user = $client->getUser(1);
//Custom rest methods
$client->requestMethod('myTestMethod', []);
$client->requestMethod('myTest', []);
This project is open-sourced software licensed under the MIT License.
See the LICENSE file for more information.