PHPackages                             jhayiwg/laravel-linkedin - 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. jhayiwg/laravel-linkedin

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

jhayiwg/laravel-linkedin
========================

artesaos/laravel-linkedin : Linkedin API integration for Laravel and Lumen 5

1.1.0(10y ago)04MITPHPPHP &gt;=5.5.9

Since Feb 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/jhayiwg/laravel-linkedin)[ Packagist](https://packagist.org/packages/jhayiwg/laravel-linkedin)[ RSS](/packages/jhayiwg-laravel-linkedin/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

### Linkedin API integration for Laravel Framework

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

[![Build Status](https://camo.githubusercontent.com/c69b94150b4f097d4a8d5cf508339ee61b7575a9301521e0eff3414a1b0e22ba/68747470733a2f2f7472617669732d63692e6f72672f6172746573616f732f6c61726176656c2d6c696e6b6564696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/artesaos/laravel-linkedin) [![Latest Stable Version](https://camo.githubusercontent.com/9c6d41f3564a961876d9afa7b2d02ec8b0eb4fbf0d1e1d844f84c10502117057/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f6c61726176656c2d6c696e6b6564696e2f762f737461626c65)](https://packagist.org/packages/artesaos/laravel-linkedin) [![Total Downloads](https://camo.githubusercontent.com/4dfb5201063e9e23c60ed4f651c1db407e952f78af6401840f31cf3a9e0214ab/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f6c61726176656c2d6c696e6b6564696e2f646f776e6c6f616473)](https://packagist.org/packages/artesaos/laravel-linkedin) [![Latest Unstable Version](https://camo.githubusercontent.com/7f878477407b4968bcbdb11a95850452e8aeedbbdb77dc86eb40d9808404db64/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f6c61726176656c2d6c696e6b6564696e2f762f756e737461626c65)](https://packagist.org/packages/artesaos/laravel-linkedin) [![License](https://camo.githubusercontent.com/b681a1e8dcf15c351fdd5ae5f1681d0b5a8d8586d52c1d1f0f3893a4326f7ca6/68747470733a2f2f706f7365722e707567782e6f72672f6172746573616f732f6c61726176656c2d6c696e6b6564696e2f6c6963656e7365)](https://packagist.org/packages/artesaos/laravel-linkedin)

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

> I encourage users to test the branch [psr-7](https://github.com/artesaos/laravel-linkedin/tree/psr-7) , which is being adopted the psr-7 structure and the independence of an specific http-client. Once the dependencies are stable I will be merge. Please report any bugs or problems.

###### 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 artesaos/laravel-linkedin
```

##### Add service Provider

[](#add-service-provider)

```
Artesaos\LinkedIn\LinkedinServiceProvider::class,

```

##### Facade

[](#facade)

```
'LinkedIn'  => \Artesaos\LinkedIn\Facades\LinkedIn::class,

```

##### Publish config file

[](#publish-config-file)

```
php artisan vendor:publish --provider="Artesaos\LinkedIn\LinkedinServiceProvider"

```

### Installation on Lumen

[](#installation-on-lumen)

##### Install with composer

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

```
composer require artesaos/laravel-linkedin
```

##### Add Service Provider, facade and config parameters to the `bootstrap/app.php` file

[](#add-service-provider-facade-and-config-parameters-to-the-bootstrapappphp-file)

```
$app->register(\Artesaos\LinkedIn\LinkedinServiceProvider::class);
class_alias(\Artesaos\LinkedIn\Facades\LinkedIn::class,'LinkedIn');

config(['linkedin' => [
        'api_key' => env('LINKEDIN_KEY','yourapikey'),
        'api_secret' => env('LINKEDIN_SECRET','yourapisecret')
]]);
```

### 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 `LinkedIn` facade. Instead of this:

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

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

```
LinkedIn::foo();
```

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

#### LinkedIn login

[](#linkedin-login)

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

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

//if not authenticated
$url = LinkedIn::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('v1/people/~:(firstName,num-connections,picture-url)');
```

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.

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

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

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

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

```
$options = array(
'format' => 'xml',
'body' => '
 Im testing Happyr LinkedIn client! https://github.com/Happyr/LinkedIn-API-client

   anyone

');
```

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

[](#configuration)

### The api options

[](#the-api-options)

The third parameter of `LinkedIn::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 API!',
    'visibility' => array('code' => 'anyone')
);

LinkedIn::post('v1/people/~/shares', array('json'=>$body));
LinkedIn::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
LinkedIn::setFormat('xml');

// Set format for just one request
LinkedIn::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 `LinkedIn::setResponseDataType` or as an option for `LinkedIn::api`

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

// Set format for just one request
LinkedIn::get('v1/people/~:(firstName,lastName)', 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 = LinkedIn::getLoginUrl(array('scope'=>$scope));
return "Login with LinkedIn";
```

#### Changelog

[](#changelog)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 96.9% 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

Every ~33 days

Total

2

Last Release

3707d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cef8e58fc1f6b2336fc915160132943db731163f5f0888b28ac223b329de5e62?d=identicon)[jhayiwg](/maintainers/jhayiwg)

---

Top Contributors

[![mauri870](https://avatars.githubusercontent.com/u/10168637?v=4)](https://github.com/mauri870 "mauri870 (63 commits)")[![jhayiwg](https://avatars.githubusercontent.com/u/17201859?v=4)](https://github.com/jhayiwg "jhayiwg (2 commits)")

---

Tags

apiclientsdkrestlumenintegrationlinkedinlaravel-framework

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[artesaos/laravel-linkedin

Linkedin API integration for Laravel and Lumen 5

5666.5k](/packages/artesaos-laravel-linkedin)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[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)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[rap2hpoutre/jacky

Opinionated REST JSON HTTP API client for laravel

174.4k](/packages/rap2hpoutre-jacky)

PHPackages © 2026

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