PHP code example of schulzefelix / laravel-search-console
1. Go to this page and download the library: Download schulzefelix/laravel-search-console 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/ */
schulzefelix / laravel-search-console example snippets
use SearchConsole;
//list all available sites for that token
SearchConsole::setAccessToken($token)->listSites();
//get site details (permissionLevel) for specific site
SearchConsole::setAccessToken($token)->getSite('http://blog.example.com/');
return [
/*
|--------------------------------------------------------------------------
| Authentication
|--------------------------------------------------------------------------
| Google offers access via OAuth client IDs or service accounts.
| For more information see: https://developers.google.com/identity/protocols/OAuth2
|
| Supported: "oauth", "oauth_json", "service_account",
*/
'auth_type' => env('GOOGLE_AUTH_TYPE', 'oauth'),
/*
|--------------------------------------------------------------------------
| Application Credentials
|--------------------------------------------------------------------------
|
| https://developers.google.com/api-client-library/php/auth/service-accounts#creatinganaccount
*/
'connections' => [
'oauth' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
],
'oauth_json' => [
'auth_config' => storage_path('app/searchconsole/oauth-account-credentials.json'),
],
'service_account' => [
'application_credentials' => storage_path('app/searchconsole/service-account-credentials.json'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Settings
|--------------------------------------------------------------------------
| Here you may configure the "store" that the underlying Google_Client will
| use to store it's data. You may also add extra parameters that will
| be passed on setCacheConfig (see docs for google-api-php-client).
|
| Optional parameters: "lifetime", "prefix"
*/
'cache' => [
'store' => 'file',
],
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
*/
'application_name' => env('SEARCH_CONSOLE_APPLICATION_NAME', 'GSC Agent'),
];