PHP code example of alexkart / looker-php-sdk-advanced

1. Go to this page and download the library: Download alexkart/looker-php-sdk-advanced 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/ */

    

alexkart / looker-php-sdk-advanced example snippets




$config = new \App\CustomLookerConfiguration(
    'https://looker-host:19999/api/4.0',
    'client-id',
    'client-secret',
);
$looker = new \Alexkart\Looker\Looker($config);

$looks = $looker->lookApi->searchLooks(null, 'test');
$dashboards = $looker->dashboardApi->allDashboards(['title']);
$folders = $looker->folderApi->allFolders();

$config = new \Alexkart\Looker\LookerConfiguration(
    'https://looker-host:19999/api/4.0',
    '',
    '',
    'access-token'
);
$looker = new \Alexkart\Looker\Looker($config);

$config = new \Alexkart\Looker\LookerConfiguration(
    'https://looker-host:19999/api/4.0',
    'client-id',
    'client-secret',
    'optional-access-token'
);
$looker = new \Alexkart\Looker\Looker($config);

if ($looker->getLookerConfig()->isAccessTokenRenewed()) {
    $token = $looker->getLookerConfig()->getAccessToken();
}

class CustomLookerConfiguration extends \Alexkart\Looker\LookerConfiguration {
    public function storeAccessToken($accessToken): void {
        file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'looker_access_token.txt', $accessToken);
    }
}

class CustomLookerConfiguration extends \Alexkart\Looker\LookerConfiguration {
    public function storeAccessToken($accessToken): void {
        file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'looker_access_token.txt', $accessToken);
    }
    public function loadAccessToken(): string {
        return (string)file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'looker_access_token.txt');
    }
}

composer