rishats/linkedin-php

LinkedIn的PHP库

dev-master 2019-07-09 08:15 UTC

This package is auto-updated.

Last update: 2024-09-09 19:09:08 UTC


README

LinkedIn API V2的PHP客户端。

要求

  • php >= 7.0

安装

composer require rishats/linkedin-php:"dev-master"

使用LinkedIn API

要与LinkedIn API一起工作,必须初始化Client类。

$client = new Client('appId', 'appSecret', 'returnUrl');

身份验证

$client = new Client('appId', 'appSecret', 'returnUrl');
if ($_GET['code']) {
    $client->initToken($_GET['code']);
    
    $me = new Me($client);
} else {
    $authUrl = $client->getAuthorizationUrl([
        'scope' => [Client::PERMISSION_LITE_PROFILE]
    ]);
    header('Location: '.$authUrl);
    exit;
}