Download the PHP package revolution/laravel-google-searchconsole without Composer

On this page you can find all versions of the php package revolution/laravel-google-searchconsole. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-google-searchconsole

Google SearchConsole API for Laravel

Maintainability Code Coverage Ask DeepWiki

https://developers.google.com/webmaster-tools

Overview

This Laravel package provides a comprehensive PHP wrapper for the Google Search Console API, enabling you to seamlessly integrate Search Console functionality into your Laravel applications. With this package, you can:

The package leverages the powerful revolution/laravel-google-sheets dependency for Google API client management and authentication, providing automatic token refresh and robust error handling.

Perfect for: SEO tools, analytics dashboards, automated reporting, website monitoring, and any application that needs to access Google Search Console data programmatically.

Requirements

Installation

Uninstall

Sample project

https://github.com/invokable/search-console-project

Configuration

Authentication Methods

This package supports two authentication methods for accessing the Google Search Console API:

Prerequisites

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Search Console API
  4. Create credentials based on your chosen authentication method

OAuth 2.0 Setup (using Socialite)

For OAuth authentication, this package works seamlessly with Laravel Socialite's official Google driver.

1. Install Laravel Socialite

2. Create OAuth 2.0 Credentials

In Google Cloud Console:

  1. Go to "Credentials" → "Create Credentials" → "OAuth 2.0 Client IDs"
  2. Set application type to "Web application"
  3. Add your authorized redirect URIs (e.g., https://yourapp.com/auth/google/callback)

3. Configure OAuth Settings

Add to config/services.php:

Add to config/google.php:

4. Environment Variables for OAuth

Service Account Setup

Service Accounts provide server-to-server authentication without user interaction. The Service Account email must be added as an owner or user in Search Console for each property you want to access.

1. Create Service Account Credentials

In Google Cloud Console:

  1. Go to "Credentials" → "Create Credentials" → "Service Account"
  2. Fill in the service account details
  3. Create and download the JSON key file

2. Configure Service Account

The package automatically uses Service Account authentication when configured through the laravel-google-sheets dependency. Place your service account JSON file in your Laravel storage directory.

Even for service accounts, scopes must be set in config/google.php:

3. Environment Variables for Service Account

Option 1: Using File Path

Option 2: Using JSON String

GOOGLE_SERVICE_ACCOUNT_JSON_LOCATION can be an array other than a file path, so you can set it as a JSON string in .env and decode it to an array in config/google.php.

This method is particularly well-suited for GitHub Actions deployment, as it allows the entire service account credentials to be stored as a single secret.

4. Add Service Account to Search Console

  1. Go to Google Search Console
  2. Select your property
  3. Go to Settings → Users and permissions
  4. Add your service account email as a user with "Full" permissions

Creating Custom Queries

All query classes extend Revolution\Google\SearchConsole\Query\AbstractQuery, which is a subclass of Google\Service\Webmasters\SearchAnalyticsQueryRequest. This provides access to all Google Search Console API query parameters.

Generate Query Classes

Use the Artisan command to create new query classes in app/Search:

Query Structure

Each query class must implement the init() method where you define your query parameters:

Available Query Parameters

You can use any of the following methods in your init() method:

Date Range

Dimensions (group results by)

Filters

Additional Options

Example Query Classes

Top Pages Query

Mobile Search Queries

Country Performance Query

Basic Usage

Using OAuth 2.0 Authentication

When using OAuth, you'll need to obtain access tokens through the Socialite authentication flow, then use setAccessToken() to authenticate your requests.

1. OAuth Authentication Flow (Controller Example)

2. Using OAuth with Model Integration

You can use the WithSearchConsole trait to integrate Search Console functionality directly into your models:

Then use it in your application:

Using Service Account Authentication

With Service Account authentication, the package automatically handles authentication through the GoogleApiClient included in laravel-google-sheets. No manual token management is required.

Service Account Usage Example

Using Service Account in Commands

Quick Reference

Available Facade Methods

Response Structure

The API returns objects with the following structure:

Laravel Helper Functions for Response Handling

The response objects work seamlessly with Laravel's helper functions, making data manipulation more convenient:

Using data_get() for Safe Property Access

Using collect() for Enhanced Data Processing

LICENSE

MIT


All versions of laravel-google-searchconsole with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0||^12.0
revolution/laravel-google-sheets Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package revolution/laravel-google-searchconsole contains the following files

Loading the files please wait ....