PHPackages                             scottybo/linkedin-api-client-v2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. scottybo/linkedin-api-client-v2

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

scottybo/linkedin-api-client-v2
===============================

LinkedIn API v2 client. Handles OAuth, CSRF protection. Easy to implement and extend. This is a standalone library for any composer project.

1.03(4y ago)44802MITPHPPHP ^5.5 || ^7.0

Since Jun 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/scottybo/LinkedIn-API-client-v2)[ Packagist](https://packagist.org/packages/scottybo/linkedin-api-client-v2)[ Docs](https://github.com/scottybo/LinkedIn-API-client-v2)[ RSS](/packages/scottybo-linkedin-api-client-v2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (5)Used By (0)

WARNING
=======

[](#warning)

This is a work in progress - it's not complete so don't use it!!

LinkedIn API client in PHP
==========================

[](#linkedin-api-client-in-php)

[![Latest Version](https://camo.githubusercontent.com/0330c8fc19a2d946fb136ffbef9f788562ff984e69b1f8afc64b3221040f5238/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f4861707079722f4c696e6b6564496e2d4150492d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/Happyr/LinkedIn-API-client/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/85737c51c57993dd0b2fb97caede098afa5add0d685c1204fa1e9de5b0b97f98/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4861707079722f4c696e6b6564496e2d4150492d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Happyr/LinkedIn-API-client)[![SensioLabsInsight](https://camo.githubusercontent.com/8ae7e63ed6ee295003793c8c84867f6f032e3325adad070868fdee89575da4e5/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34346334323561662d393066362d346332352d623738392d3465636532386230316132622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/44c425af-90f6-4c25-b789-4ece28b01a2b)[![Code Coverage](https://camo.githubusercontent.com/fea8462500540f45a598a554f6cbed3102e105b7785a053886348db446d0ba98/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f4861707079722f4c696e6b6564496e2d4150492d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Happyr/LinkedIn-API-client)[![Quality Score](https://camo.githubusercontent.com/fb0636e297b632a5704efa0b922fb6ca44fe2c4b8ebb98d89b3ef34240367c56/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4861707079722f4c696e6b6564496e2d4150492d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Happyr/LinkedIn-API-client)[![Total Downloads](https://camo.githubusercontent.com/51c3449ee3a91a03a55bb529aeaf409ca1d004a571e2bd449f789c53c2a6ecf7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861707079722f6c696e6b6564696e2d6170692d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/happyr/linkedin-api-client)

A PHP library to handle authentication and communication with LinkedIn API. The library/SDK helps you to get an access token and when authenticated it helps you to send API requests. You will not get *everything* for free though... You have to read the [LinkedIn documentation](https://developer.linkedin.com/core-concepts) to understand how you should query the API.

To get an overview what this library actually is doing for you. Take a look at the authentication page from the [API docs](https://developer.linkedin.com/documents/authentication).

Features
--------

[](#features)

Here is a list of features that might convince you to choose this LinkedIn client over some of our competitors'.

- Flexible and easy to extend
- Developed with modern PHP standards
- Not developed for a specific framework.
- Handles the authentication process
- Respects the CSRF protection

Installation
------------

[](#installation)

**TL;DR**

```
composer require php-http/curl-client guzzlehttp/psr7 php-http/message happyr/linkedin-api-client
```

This library does not have a dependency on Guzzle or any other library that sends HTTP requests. We use the awesome HTTPlug to achieve the decoupling. We want you to choose what library to use for sending HTTP requests. Consult this list of packages that support [php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation)find clients to use. For more information about virtual packages please refer to [HTTPlug](http://docs.php-http.org/en/latest/httplug/users.html). Example:

```
composer require php-http/guzzle6-adapter
```

You do also need to install a PSR-7 implementation and a factory to create PSR-7 messages (PSR-17 whenever that is released). You could use Guzzles PSR-7 implementation and factories from php-http:

```
composer require guzzlehttp/psr7 php-http/message
```

Now you may install the library by running the following:

```
composer require happyr/linkedin-api-client
```

If you are updating form a previous version make sure to read [the upgrade documentation](Upgrade.md).

### Finding the HTTP client (optional)

[](#finding-the-http-client-optional)

The LinkedIn client need to know what library you are using to send HTTP messages. You could provide an instance of HttpClient and MessageFactory or you could fallback on auto discovery. Below is an example on where you provide a Guzzle6 instance.

```
$linkedIn=new Happyr\LinkedIn\LinkedIn('app_id', 'app_secret');
$linkedIn->setHttpClient(new \Http\Adapter\Guzzle6\Client());
$linkedIn->setHttpMessageFactory(new Http\Message\MessageFactory\GuzzleMessageFactory());
```

Usage
-----

[](#usage)

In order to use this API client (or any other LinkedIn clients) you have to [register your application](https://www.linkedin.com/secure/developer)with LinkedIn to receive an API key. Once you've registered your LinkedIn app, you will be provided with an *API Key* and *Secret Key*.

### LinkedIn login

[](#linkedin-login)

This example below is showing how to login with LinkedIn.

```
