Download the PHP package mauri870/laravel-linkedin without Composer
On this page you can find all versions of the php package mauri870/laravel-linkedin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mauri870/laravel-linkedin
More information about mauri870/laravel-linkedin
Files in mauri870/laravel-linkedin
Package laravel-linkedin
Short Description Linkedin API integration for Laravel Framework
License MIT
Informations about the package laravel-linkedin
Linkedin API integration for Laravel Framework
:warning: DISCONTINUED AND MIGRATED :construction:
This project is discontinued. I will not offer more support and bugfixes here. For the newer changes, support and improvements please refer to artesaos/laravel-linkedin
This package is a wrapper for Happyr/LinkedIn-API-client. You can view the basic intructions here. Don't forget to consult the oficial LinkedIn API site.
I encourage users to test the branch 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 Laravel
Install with composer
Add service Provider
Facade
Publish config file
Installation on Lumen
Install with composer
Add Service Provider, facade and config parameters to the bootstrap/app.php
file
Usage
In order to use this API client (or any other LinkedIn clients) you have to register your app
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:
you can simple call the facade for anyone method, like this:
The service container automatically return an instance of LinkedIn
class ready to use
LinkedIn login
This example below is showing how to login with LinkedIn using LinkedIn
facade.
Get basic profile info
You can retrive information using the get()
method, like this:
This query return an array of information. You can view all the REST
api's methods in REST API Console
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. 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. |
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. |
response_data_type | To override the response format for one request |
query | This is an array with query parameters |
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.
When using array('json'=>$body)
as option the format will always be json
. You can change the request format in three ways.
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
Below is a table that specifies what the possible return data types are when you call LinkedIn::api
.
Type | Description |
---|---|
array | An assosiative array. This can only be used with the json format. |
simple_xml | A SimpleXMLElement. See PHP manual. This can only be used with the xml format. |
psr7 | A PSR7 response. |
stream | A file stream. |
string | A plain old string. |
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.
All versions of laravel-linkedin with dependencies
illuminate/contracts Version ~5.1 || ~5.2
illuminate/http Version ~5.1 || ~5.2
illuminate/support Version ~5.1 || ~5.2
illuminate/database Version ~5.1 || ~5.2
happyr/linkedin-api-client Version 0.6.*