PHPackages                             scottybo/laravel-linkedin-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. [HTTP &amp; Networking](/categories/http)
4. /
5. scottybo/laravel-linkedin-v2

ActiveLibrary[HTTP &amp; Networking](/categories/http)

scottybo/laravel-linkedin-v2
============================

Linkedin API v2 integration for Laravel and Lumen 5

1(7y ago)11721[1 issues](https://github.com/scottybo/Laravel-LinkedIn-v2/issues)MITPHPPHP &gt;=5.5.9

Since Jun 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/scottybo/Laravel-LinkedIn-v2)[ Packagist](https://packagist.org/packages/scottybo/laravel-linkedin-v2)[ RSS](/packages/scottybo-laravel-linkedin-v2/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

### Linkedin API v2 integration for Laravel Framework

[](#linkedin-api-v2-integration-for-laravel-framework)

DO NOT USE - STILL IN DEVELOPMENT

This package is a wrapper for [Scottybo/LinkedIn-API-client-v2](https://github.com/scottybo/Laravel-LinkedIn-v2). You can view the documentation for php version [here](https://github.com/scottybo/LinkedIn-API-client-v2/blob/master/README.md). Don't forget to consult the oficial [LinkedIn API](https://developer.linkedin.com/) site.

###### If you need install on Lumen, go to [Lumen section](#installation-on-lumen)

[](#if-you-need-install-on-lumen-go-to-lumen-section)

### Installation on Laravel

[](#installation-on-laravel)

##### Install with composer

[](#install-with-composer)

```
composer require scottybo/laravel-linkedin-v2
```

##### Add service Provider

[](#add-service-provider)

```
Scottybo\LinkedIn\LinkedinServiceProviderV2::class,

```

##### Facade

[](#facade)

```
'LinkedInV2'  => \Scottybo\LinkedIn\Facades\LinkedInV2::class,

```

##### Publish config file

[](#publish-config-file)

```
php artisan vendor:publish --provider="Scottybo\LinkedIn\LinkedinServiceProviderV2"

```

### Installation on Lumen

[](#installation-on-lumen)

##### Install with composer

[](#install-with-composer-1)

```
composer require scottybo/laravel-linkedin-v2
```

##### Add Service Provider, facade and config parameters to the `bootstrap/app.php` file and copy the [linkedin.php](https://github.com/scottybo/laravel-linkedin-v2/blob/master/src/Scottybo/LinkedIn/config/linkedin-v2.php) to the config directory of your project (create then if not exists)

[](#add-service-provider-facade-and-config-parameters-to-the-bootstrapappphp-file-and-copy-the-linkedinphp-to-the-config-directory-of-your-project-create-then-if-not-exists)

```
$app->register(\Scottybo\LinkedIn\LinkedinServiceProviderV2::class);
class_alias(\Scottybo\LinkedIn\Facades\LinkedInV2::class,'LinkedInV2');

$app->configure('linkedin-v2');
```

### Usage

[](#usage)

In order to use this API client (or any other LinkedIn clients) you have to [register your app](https://www.linkedin.com/developer/apps)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*, please fill this values on `linkedin.php` config file.

\####Basic Usage The unique difference in this package is the `LinkedInV2` facade. Instead of this:

```
$linkedIn=new ScottyBo\LinkedIn\LinkedIn('app_id', 'app_secret');
$linkedin->foo();
```

you can simple call the facade for anyone method, like this:

```
LinkedInV2::foo();
```

or use the laravel container:

```
app('linkedin-v2')->foo();
app()['linkedin-v2']->foo();
App::make('linkedin-v2')->foo(); // ...
```

The service container automatically return an instance of `LinkedInV2` class ready to use

#### LinkedIn login

[](#linkedin-login)

This example below is showing how to login with LinkedIn using `LinkedIn` facade.

```
if (LinkedInV2::isAuthenticated()) {
     //we know that the user is authenticated now. Start query the API
     $user=LinkedIn::get('v2/me');
     echo  "Welcome ".$user['firstName'];
     exit();
}elseif (LinkedInV2::hasError()) {
     echo  "User canceled the login.";
     exit();
}

//if not authenticated
$url = LinkedInV2::getLoginUrl();
echo "Login with LinkedIn";
exit();
```

#### Get basic profile info

[](#get-basic-profile-info)

You can retrive information using the `get()` method, like this:

```
LinkedIn::get('v2/me');
```

This query return an array of information. You can view all the `REST` api's methods in [REST API Console](https://apigee.com/console/linkedin)

#### How to post on LinkedIn wall

[](#how-to-post-on-linkedin-wall)

The example below shows how you can post on a users wall. The access token is fetched from the database.

```
LinkedInV2::setAccessToken('access_token_from_db');

$options = ['json'=>
     [
        'comment' => 'Im testing Scottybo LinkedIn v2 client with Laravel Framework! https://github.com/scottybo/laravel-linkedin-v2',
        'visibility' => [
               'code' => 'anyone'
        ]
     ]
];

$result = LinkedIn::post('v2/people/~/shares', $options);
```

You may of course do the same in xml. Use the following options array.

```
$options = array(
'format' => 'xml',
'body' => '
 Im testing Scottybo LinkedIn v2 client with Laravel Framework! https://github.com/scottybo/laravel-linkedin-v2

   anyone

');
```

Configuration
-------------

[](#configuration)

### The api options

[](#the-api-options)

The third parameter of `LinkedInV2::api` is an array with options. Below is a table of array keys that you may use.

Option nameDescriptionbodyThe body of a HTTP request. Put your xml string here.formatSet this to 'json', 'xml' or 'simple\_xml' to override the default value.headersThis is HTTP headers to the requestjsonThis is an array with json data that will be encoded to a json string. Using this option you do need to specify a format.response\_data\_typeTo override the response format for one requestqueryThis is an array with query parameters### Changing request format

[](#changing-request-format)

The default format when communicating with LinkedIn API is json. You can let the API do `json_encode` for you. The following code shows you how.

```
$body = array(
    'comment' => 'Testing the linkedin v2 API!',
    'visibility' => array('code' => 'anyone')
);

LinkedInV2::post('v1/people/~/shares', array('json'=>$body));
LinkedInV2::post('v1/people/~/shares', array('body'=>json_encode($body)));
```

When using `array('json'=>$body)` as option the format will always be `json`. You can change the request format in three ways.

```
// By setter
LinkedInV2::setFormat('xml');

// Set format for just one request
LinkedInV2::post('v1/people/~/shares', array('format'=>'xml', 'body'=>$body));
```

### Understanding response data type

[](#understanding-response-data-type)

The data type returned from `LinkedIn::api` can be configured. You may use the `LinkedInV2::setResponseDataType` or as an option for `LinkedInV2::api`

```
// By setter
LinkedInV2::setResponseDataType('simple_xml');

// Set format for just one request
LinkedInV2::get('v2/me', array('response_data_type'=>'psr7'));
```

Below is a table that specifies what the possible return data types are when you call `LinkedIn::api`.

TypeDescriptionarrayAn assosiative array. This can only be used with the `json` format.simple\_xmlA SimpleXMLElement. See [PHP manual](http://php.net/manual/en/class.simplexmlelement.php). This can only be used with the `xml` format.psr7A PSR7 response.streamA file stream.stringA plain old string.### Using different scopes

[](#using-different-scopes)

If you want to define special scopes when you authenticate the user you should specify them when you are generating the login url. If you don't specify scopes LinkedIn will use the default scopes that you have configured for the app.

```
$scope = 'r_fullprofile,r_emailaddress,w_share';
//or
$scope = array('rw_groups', 'r_contactinfo', 'r_fullprofile', 'w_messages');

$url = LinkedInV2::getLoginUrl(array('scope'=>$scope));
return "Login with LinkedIn";
```

#### Changelog

[](#changelog)

You can view the latest changes [here](https://github.com/scottybo/laravel-linkedin-v2/blob/master/CHANGELOG.md)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2885d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11498904?v=4)[Scott Bowler](/maintainers/scottybo)[@scottybo](https://github.com/scottybo)

---

Top Contributors

[![scottybo](https://avatars.githubusercontent.com/u/11498904?v=4)](https://github.com/scottybo "scottybo (2 commits)")

---

Tags

apiclientsdkrestlumenintegrationlinkedinlaravel-frameworklinkedin-v2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/scottybo-laravel-linkedin-v2/health.svg)

```
[![Health](https://phpackages.com/badges/scottybo-laravel-linkedin-v2/health.svg)](https://phpackages.com/packages/scottybo-laravel-linkedin-v2)
```

###  Alternatives

[artesaos/laravel-linkedin

Linkedin API integration for Laravel and Lumen 5

5666.5k](/packages/artesaos-laravel-linkedin)[zoonman/linkedin-api-php-client

LinkedIn API PHP SDK with OAuth 2.0 &amp; CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.

127704.0k](/packages/zoonman-linkedin-api-php-client)[arhitector/yandex

PHP SDK для работы с некоторыми сервисами яндекса (Яндекс.Диск, Yandex.Disk)

13082.9k5](/packages/arhitector-yandex)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
