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

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

phillipsdata/linkedin
=====================

PHP LinkedIn SDK

2.2.0(7y ago)3245MITPHPPHP &gt;=5.4.0

Since Jan 3Pushed 7y ago4 watchersCompare

[ Source](https://github.com/phillipsdata/linkedin-api)[ Packagist](https://packagist.org/packages/phillipsdata/linkedin)[ Docs](https://github.com/phillipsdata/linkedin-api)[ RSS](/packages/phillipsdata-linkedin/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (18)Used By (0)

phillipsdata/linkedin-api
=========================

[](#phillipsdatalinkedin-api)

This library allows you to communicate with the LinkedIn APIs. It is very generic and depends on the user to know their target endpoints and the data to be submitted.

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

[](#installation)

Install via composer:

```
composer require phillipsdata/linkedin
```

Usage
-----

[](#usage)

To start, instantiate the class

```
$linkedin = new LinkedIn(
    'LINKEDIN_API_KEY',
    'LINKEDIN_API_SECRET',
    'LINKEDIN_CALLBACK_URL'
);
```

Get a URL to visit and be granted permissions from

```
$permissions_url = $linkedin->getPermissionUrl(
    array(
        'r_basicprofile',
        'r_liteprofile',
        'w_share',
        'w_member_social'
    )
);
```

The parameter here is a list of 'scopes'. If granted, they determine which API calls you are authorized to make.

API v1 Permissions

- r\_basicprofile
- r\_emailaddress
- w\_share
- rw\_company\_admin

API v2 Permissions

- r\_liteprofile (replaces r\_basicprofile)
- r\_emailaddress
- w\_member\_social (replaces w\_share)

After visiting the $permission\_url, you will be redirected to the 'LINKEDIN\_CALLBACK\_URL' you submitted to the constructor. The redirect will submit a 'code' get parameter to that location which can be used to generate an access token that will be used to grant permission for future API calls.

```
$tokenResponse = $linkedin->getAccessToken($_GET['code']);

if ($tokenResponse->status() == 200) {
  // Record $tokenResponse->response() in some way
} else {
  echo $tokenResponse->errors();
}
```

This will return the access token if you want to store it somehow. Additionally it will set the token on your current LinkedIn object which will use it for any API calls you make.

After this you can make any api call you like as long you know the endpoint and data required

See the [docs here](https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context#create-a-text-share) for a full description of making a share request

```
$data = [
    'author' => 'urn:li:person:123456',
    'lifecycleState' => 'PUBLISHED',
    'specificContent' => [
        'com.linkedin.ugc.ShareContent' => [
            'shareCommentary' => [
                'text' => "Leverage LinkedIn's APIs to maximize engagement"
            ],
            'shareMediaCategory' => 'NONE'
        ]
    ],
    'visibility' => ['com.linkedin.ugc.MemberNetworkVisibility' => 'PUBLIC']
];

$shareResponse = $linkedin->post('v2/ugcPosts', $data);
```

The response is returned as an LinkedInAPIResponse object that can be accessed like this

```
$shareResponse->headers(); // An array of header fields and their values
$shareResponse->raw(); // Exactly what was returned by LinkedIn, including headers
$shareResponse->response(); // An object containing the data returned by LinkedIn
$shareResponse->errors(); // Any errors given in the response
$shareResponse->status(); // The status code returned by the request
```

The API also has a method called share() which takes a bit of work off of the user by formatting the data how LinkedIn expects.

This method worked different pre v2.x. Instead it used version 1 of the LinkedIn api and simply defaulted the endpoint.

```
$shareResponse = $linkedin->share('Leverage LinkedIn's APIs to maximize engagement');
```

or

```
$shareResponse = $linkedin->share(
    'Leverage LinkedIn's APIs to maximize engagement',
    [
        'urn' => 'urn:li:digitalmediaAsset:C5422AQEbc381YmIuvg',
        'type' => 'IMAGE',
        'title' => 'LinkedIn API',
        'description' => 'Shows how great the LinkedIn API is.'
    ],
    'CONNECTIONS'
);
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~5 days

Total

13

Last Release

2627d ago

Major Versions

1.1.x-dev → 2.0.02019-02-27

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.1.0PHP &gt;=5.4.0

### Community

Maintainers

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

---

Top Contributors

[![JReissmueller](https://avatars.githubusercontent.com/u/18198499?v=4)](https://github.com/JReissmueller "JReissmueller (9 commits)")

---

Tags

apirestapi clientlinkedin

### Embed Badge

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

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

###  Alternatives

[linkedinapi/linkedin

PHP LinkedIn SDK

96357.1k4](/packages/linkedinapi-linkedin)[wrapi/slack

Wrapper for Slack Web API

56272.3k2](/packages/wrapi-slack)[artesaos/laravel-linkedin

Linkedin API integration for Laravel and Lumen 5

5666.5k](/packages/artesaos-laravel-linkedin)

PHPackages © 2026

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