PHPackages                             michaelcrowcroft/google-search-console-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. michaelcrowcroft/google-search-console-laravel

ActiveLibrary[API Development](/categories/api)

michaelcrowcroft/google-search-console-laravel
==============================================

A Laravel package for Google Search Console API integration

v1.0.0(8mo ago)1151MITPHPPHP ^8.4

Since Aug 25Pushed 8mo agoCompare

[ Source](https://github.com/MichaelCrowcroft/google-search-console-laravel)[ Packagist](https://packagist.org/packages/michaelcrowcroft/google-search-console-laravel)[ Docs](https://github.com/michaelcrowcroft/google-search-console-laravel)[ RSS](/packages/michaelcrowcroft-google-search-console-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Google Search Console for Laravel
=================================

[](#google-search-console-for-laravel)

A simple Laravel package for the Google Search Console API.

Installation
------------

[](#installation)

```
composer require michaelcrowcroft/google-search-console-laravel

php artisan vendor:publish --provider="MichaelCrowcroft\\GoogleSearchConsole\\GoogleSearchConsoleServiceProvider" --tag="google-search-console-config"
```

Usage
-----

[](#usage)

```
use GoogleSearchConsole;

// Set your access token and default site URL
GoogleSearchConsole::setAccessToken($token);
GoogleSearchConsole::setSiteUrl('https://example.com');

// Query search analytics
$data = GoogleSearchConsole::analytics()->query([
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
    'dimensions' => ['query', 'page'],
    'row_limit' => 100
]);

// Helper methods
$queries = GoogleSearchConsole::analytics()->getQueryData('2024-01-01', '2024-01-31');
$pages = GoogleSearchConsole::analytics()->getPageData('2024-01-01', '2024-01-31');
$countries = GoogleSearchConsole::analytics()->getCountryData('2024-01-01', '2024-01-31');

// Pass a different site if you want to overwrite the set URL, or haven't set one already.
$queries = GoogleSearchConsole::analytics()->getQueryData('https://othersite.com', '2024-01-01', '2024-01-31');
```

Analytics
---------

[](#analytics)

### The Query Method

[](#the-query-method)

The most powerful way to get search analytics data:

```
// Basic query (uses default site URL)
$data = GoogleSearchConsole::analytics()->query([
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
    'dimensions' => ['query'],
    'row_limit' => 100
]);

// Multiple dimensions
$data = GoogleSearchConsole::analytics()->query([
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
    'dimensions' => ['query', 'page', 'country'],
    'row_limit' => 1000
]);

// With filters
$data = GoogleSearchConsole::analytics()->query([
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
    'dimensions' => ['query'],
    'filters' => [
        // Dimension filter groups
    ],
    'row_limit' => 500
]);

// Or specify different site URL
$data = GoogleSearchConsole::analytics()->query('https://othersite.com', [
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
    'dimensions' => ['query']
]);
```

### Helper Methods

[](#helper-methods)

For common use cases:

```
// Get top queries (uses default site URL)
$queries = GoogleSearchConsole::analytics()->getQueryData('2024-01-01', '2024-01-31', 100);

// Get top pages
$pages = GoogleSearchConsole::analytics()->getPageData('2024-01-01', '2024-01-31', 100);

// Get country performance
$countries = GoogleSearchConsole::analytics()->getCountryData('2024-01-01', '2024-01-31', 50);

// Get device performance
$devices = GoogleSearchConsole::analytics()->getDeviceData('2024-01-01', '2024-01-31');

// Get query and page combinations
$queryPages = GoogleSearchConsole::analytics()->getQueryPageData('2024-01-01', '2024-01-31');

// Or specify different site URL for specific calls
$queries = GoogleSearchConsole::analytics()->getQueryData('https://othersite.com', '2024-01-01', '2024-01-31');
```

Sitemaps
--------

[](#sitemaps)

```
// List sitemaps (uses default site URL)
$sitemaps = GoogleSearchConsole::sitemaps()->list();

// Submit sitemap
GoogleSearchConsole::sitemaps()->submit('sitemap.xml');

// Get sitemap details
$sitemap = GoogleSearchConsole::sitemaps()->get('sitemap.xml');

// Delete sitemap
GoogleSearchConsole::sitemaps()->delete('old-sitemap.xml');

// Or specify different site URL
$sitemaps = GoogleSearchConsole::sitemaps()->list('https://othersite.com');
```

Sites
-----

[](#sites)

```
// List all verified sites
$sites = GoogleSearchConsole::sites()->list();

// Get site details (uses default site URL)
$site = GoogleSearchConsole::sites()->get();

// Check verification
$isVerified = GoogleSearchConsole::sites()->isVerified();

// Or specify different site URL
$site = GoogleSearchConsole::sites()->get('https://othersite.com');
```

URL Inspection
--------------

[](#url-inspection)

```
// Inspect URL (uses default site URL)
$result = GoogleSearchConsole::urlInspection()->inspect('https://example.com/page');

// Check if indexed
$isIndexed = GoogleSearchConsole::urlInspection()->isIndexed('https://example.com/page');

// Or specify different site URL
$result = GoogleSearchConsole::urlInspection()->inspect('https://othersite.com', 'https://othersite.com/page');
```

Token &amp; Site Management
---------------------------

[](#token--site-management)

```
// Set access token
GoogleSearchConsole::setAccessToken($token);

// Set default site URL
GoogleSearchConsole::setSiteUrl('https://example.com');

// Check validity
if (GoogleSearchConsole::isAccessTokenValid()) {
    // Proceed
}

// Get current values
$token = GoogleSearchConsole::getAccessToken();
$siteUrl = GoogleSearchConsole::getSiteUrl();
```

Error Handling
--------------

[](#error-handling)

The package throws `\Google\Service\Exception` for API errors:

```
try {
    $data = GoogleSearchConsole::analytics()->query('https://example.com', [
        'start_date' => '2024-01-01',
        'end_date' => '2024-01-31'
    ]);
} catch (\Google\Service\Exception $e) {
    Log::error('GSC Error: ' . $e->getMessage());
}
```

```
php artisan vendor:publish --provider="MichaelCrowcroft\\GoogleSearchConsole\\GoogleSearchConsoleServiceProvider" --tag="google-search-console-config"
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance59

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

260d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed75d6b169ff3c2df85f333847aab53f5ca35c9c4468776e7bdb5b5ffc44fda7?d=identicon)[MichaelCrowcroft](/maintainers/MichaelCrowcroft)

---

Top Contributors

[![MichaelCrowcroft](https://avatars.githubusercontent.com/u/11324235?v=4)](https://github.com/MichaelCrowcroft "MichaelCrowcroft (3 commits)")

---

Tags

laravelgoogleanalyticsseosearch console

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/michaelcrowcroft-google-search-console-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/michaelcrowcroft-google-search-console-laravel/health.svg)](https://phpackages.com/packages/michaelcrowcroft-google-search-console-laravel)
```

###  Alternatives

[thujohn/analytics

Google Analytics for Laravel 4

113108.7k1](/packages/thujohn-analytics)[schulzefelix/laravel-search-console

A Laravel package to retrieve data from Google Search Console

5037.8k1](/packages/schulzefelix-laravel-search-console)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)[ozankurt/google-analytics

Laravel Google Analytics

7616.7k](/packages/ozankurt-google-analytics)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
