1- LinkedIn API Client with OAuth 2 authorization witten on PHP
1+ LinkedIn API Client with OAuth 2 authorization written on PHP
22============================================================
3- [ ![ Build Status] ( https://travis-ci.org/zoonman/linkedin-client.svg )] ( https://travis-ci.org/zoonman/linkedin-client ) [ ![ Code Climate] ( https://codeclimate.com/github/zoonman/linkedin-client/badges/gpa.svg )] ( https://codeclimate.com/github/zoonman/linkedin-client ) [ ![ Packagist] ( https://img.shields.io/packagist/dt/zoonman/linkedin-client.svg )] ( https://packagist.org/packages/zoonman/linkedin-client ) [ ![ GitHub license] ( https://img.shields.io/github/license/zoonman/linkedin-client.svg )] ( https://github.com/zoonman/linkedin-client/LICENSE.md )
3+ [ ![ Build Status] ( https://travis-ci.org/zoonman/linkedin-client.svg )] ( https://travis-ci.org/zoonman/linkedin-api-php- client ) [ ![ Code Climate] ( https://codeclimate.com/github/zoonman/linkedin-api-php- client/badges/gpa.svg )] ( https://codeclimate.com/github/zoonman/linkedin-api-php- client ) [ ![ Packagist] ( https://img.shields.io/packagist/dt/zoonman/linkedin-api-php- client.svg )] ( https://packagist.org/packages/zoonman/linkedin-api-php- client ) [ ![ GitHub license] ( https://img.shields.io/github/license/zoonman/linkedin-api-php- client.svg )] ( https://github.com/zoonman/linkedin-api-php -client/LICENSE.md )
44
55
66
@@ -49,23 +49,30 @@ $client = new Client(
4949
5050#### Getting local redirect URL
5151
52- Get current redirect url use
52+ To start linking process you have to setup redirect url.
53+ You can set your own or use current one.
54+ SDK provides you a ` getRedirectUrl() ` helper for your convenience:
5355
5456``` php
55- $client->getRedirectUrl();
57+ $redirectUrl = $ client->getRedirectUrl();
5658```
5759
60+ We recommend you to have it stored during the linking session
61+ because you will need to use it when you will be getting access token.
5862
5963#### Setting local redirect URL
6064
61- To set redirect url use
65+ Set a custom redirect url use:
6266
6367``` php
6468$client->setRedirectUrl('http://your.domain.tld/path/to/script/');
6569```
6670
6771#### Getting LinkedIn redirect URL
6872
73+ In order of performing OAUTH 2.0 flow, you should get LinkedIn login URL.
74+ During this procedure you have to define scope of requested permissions.
75+ Use ` Scope ` enum class to get scope names.
6976To get redirect url to LinkedIn, use the following approach:
7077
7178``` php
@@ -76,9 +83,11 @@ $scopes = [
7683 'rw_company_admin',
7784 'w_share',
7885];
79- $loginUrl = $client->getLoginUrl(); // get url on LinkedIn to start linking
86+ $loginUrl = $client->getLoginUrl($scopes ); // get url on LinkedIn to start linking
8087```
8188
89+ Now you can take user to LinkedIn. You can use link or rely on Location HTTP header.
90+
8291#### Getting Access Token
8392
8493To get access token use (don't forget to set redirect url)
@@ -99,6 +108,17 @@ $profile = $client->api(
99108);
100109```
101110
111+ There are two helper methods:
112+
113+ ``` php
114+ // get method
115+ $client->get('ENDPOINT', ['param' => 'value']);
116+
117+ //post
118+ $client->post('ENDPOINT', ['param' => 'value']);
119+ ```
120+
121+
102122To perform api call to get profile information
103123
104124``` php
@@ -108,31 +128,42 @@ $profile = $client->get(
108128print_r($profile);
109129```
110130
111- To list companies where you an admin
131+ To list companies where you are an admin
112132
113133``` php
114134$profile = $client->get(
115- 'people/~:(id,email-address,first-name,last-name)'
135+ 'companies',
136+ ['is-company-admin' => true]
116137);
117138print_r($profile);
118139```
119140
120- To share content
141+ To share content on a personal profile
121142
122143``` php
123144$share = $client->post(
124- 'people/~/shares',
125- [
126- 'comment' => 'Checkout this amazing PHP SDK for LinkedIn!',
127- 'content' => [
128- 'title' => 'PHP Client for LinkedIn API',
129- 'description' => 'OAuth 2 flow, composer Package',
130- 'submitted-url' => 'https://github.com/zoonman/linkedin-api-php-client',
131- 'submitted-image-url' => 'https://github.com/fluidicon.png',
132- ],
133- 'visibility' => [
134- 'code' => 'anyone'
135- ]
136- ]
137- );
145+ 'people/~/shares',
146+ [
147+ 'comment' => 'Checkout this amazing PHP SDK for LinkedIn!',
148+ 'content' => [
149+ 'title' => 'PHP Client for LinkedIn API',
150+ 'description' => 'OAuth 2 flow, composer Package',
151+ 'submitted-url' => 'https://github.com/zoonman/linkedin-api-php-client',
152+ 'submitted-image-url' => 'https://github.com/fluidicon.png',
153+ ],
154+ 'visibility' => [
155+ 'code' => 'anyone'
156+ ]
157+ ]
158+ );
138159```
160+
161+
162+ ## Contributing
163+
164+ Please, open PR with your changes linked to an GitHub issue.
165+ You code must follow [ PSR] ( http://www.php-fig.org/psr/ ) standards and have PHPUnit tests.
166+
167+ ## License
168+
169+ [ MIT] ( LICENSE.md )
0 commit comments