1. Go to this page and download the library: Download artesaos/laravel-linkedin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
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 "<a href='$url'>Login with LinkedIn</a>";
exit();
// By setter
LinkedIn::setFormat('xml');
// Set format for just one request
LinkedIn::post('v1/people/~/shares', array('format'=>'xml', 'body'=>$body));
// By setter
LinkedIn::setResponseDataType('simple_xml');
// Set format for just one request
LinkedIn::get('v1/people/~:(firstName,lastName)', array('response_data_type'=>'psr7'));