Download the PHP package net-shell/linkedin-api without Composer
On this page you can find all versions of the php package net-shell/linkedin-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download net-shell/linkedin-api
More information about net-shell/linkedin-api
Files in net-shell/linkedin-api
Package linkedin-api
Short Description LinkedIn API client. Handles OAuth, CSRF protection. Easy to implement and extend. This is a standalone library for any composer project.
License MIT
Homepage http://developer.happyr.com/libraries/linkedin-php-client
Informations about the package linkedin-api
LinkedIn API client in PHP
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 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.
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
- More than 85% test coverage.
- 800 lines of code, 650 lines of comments.
Installation
Install it with Composer.
Usage
In order to use this API client (or any other LinkedIn clients) you have to register your application 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
This example below is showing how to login with LinkedIn.
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.
You may of course do the same in xml. Use the following options array.
Configuration
The api options
The third parameter of LinkedIn::api
is an array with options. They will eventually be past to a Request client but
before that we do some modifications. Below is a table of array keys that you may use.
Option name | Description |
---|---|
body | The body of a HTTP request. Put your xml string here. |
debug | This will echo the all the request and response headers. (Works with the Guzzle client only) |
format | Set this to 'json', 'xml' or 'simple_xml' to override the default value. |
headers | This is HTTP headers to the request |
json | This is an array with json data that will be encoded to a json string. Using this option you do need to specify a format. |
query | This is an array with query parameters |
If you are using the GuzzleRequest
(default) you may want to have a look at its documentation
to find out what more options that are available.
Changing format
The default format when communicating with LinkedIn API is json. This means that you will get an array back as a response when you call LinkedIn::api
. It is easy to change the format.
There is one exception to the format option: When you specifying $options['json'=>...] then the format will always be json.
Below is a table that specifies what format returns what when you call LinkedIn::api
.
Format | Return value |
---|---|
json | An assosiative array |
xml | The XML response body as a string |
simple_xml | A SimpleXMLElement. See PHP manual. |
Use different Request or Session classes
You might want to use an other storage than the default SessionStorage
. If you are using Laravel
you are more likely to inject the IlluminateSessionStorage
.
You can inject any class implementing DataStorageInterface
. You can also inject different
request and url generator classes.
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.
Framework integration
See how I integrated this with Symfony2.