reverse/linkedin-php
最新稳定版本:v0.1.0-alpha
Composer 安装命令:
composer require reverse/linkedin-php
包简介
PHP library for LinkedIn
README 文档
README
This package is deprecated and will soon be removed.
reverse/linkedin-php
PHP client for LinkedIn API V2.
Requirements
- php >= 7.0
Installation
composer require reverse/linkedin-php:"dev-master"
Using LinkedIn API
To work with LinkedIn API have to init Client classes.
$client = new Client('appId', 'appSecret', 'returnUrl');
Authentication
$client = new Client('appId', 'appSecret', 'returnUrl'); if (array_key_exists('code', $_GET)) { $client->initToken($_GET['code']); $me = new Me($client); } else { $authUrl = $client->getAuthenticationUrl([ 'scope' => [Client::PERMISSION_LITE_PROFILE] ]); header('Location: '.$authUrl); exit; }
Share
There is possibility to publish a new post or share a post on LinkedIn activities
To share a post:
$client = new Client('appId', 'appSecret', 'returnUrl'); if (array_key_exists('code', $_GET)) { $client->initToken($_GET['code']); $shares = new Shares(); $shares->setResharedShare('urn:li:share:1232132') // Post's urn:id $shares->setOwner('urn:li:person:c7RFYxyz78') $shareText = new ShareText(); $shareText->setTitle('my title'); $shares->setText($shareText); $shareEndpoint = new REverse\LinkedIn\Endpoint\Share($client); $shareEndpoint->postShares($shares); } else { $authUrl = $client->getAuthenticationUrl([ 'scope' => [Client::PERMISSION_LITE_PROFILE, Client::PERMISSION_W_MEMBER_SOCIAL] ]); header('Location: '.$authUrl); exit; }
Before to perform this operation, the user declared in setOwner must be authenticated in LinkedIn's application.
统计信息
- 总下载量: 2.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-07