elfeffe / laravel-google-indexing
Index Laravel website in Google via Indexing API
Requires
- php: ^8.2
- google/apiclient: ^2.15
- illuminate/console: ^11.0|^12.0
- illuminate/contracts: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.13
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2025-04-03 17:07:28 UTC
README
Request a page to be indexed by Google using the Indexing API.
This package is a fork of famdirksen/laravel-google-indexing updated for Laravel 11 and 12 compatibility.
Please, take a note at the allowed pages that can be indexed using this API at https://developers.google.com/search/apis/indexing-api/v3/quickstart.
Installation
You can install the package via composer:
composer require elfeffe/laravel-google-indexing
Next you have to follow the setup instructions from Google, this can be found here Google Indexing API documentation.
You need to make a file in your storage direct, but you can override this setting in config with the key laravel-google-indexing.google.auth_config
.
Usage
NOTE: this package works only for verified sites in your Google Search Console account
Inform Google about a new or updated URL:
use Elfeffe\LaravelGoogleIndexing\Facades\LaravelGoogleIndexingFacade as LaravelGoogleIndexing; LaravelGoogleIndexing::update('https://www.my-domain.com')
Delete an URL from the index:
use Elfeffe\LaravelGoogleIndexing\Facades\LaravelGoogleIndexingFacade as LaravelGoogleIndexing; LaravelGoogleIndexing::delete('https://www.my-domain.com')
Get the status of an URL:
use Elfeffe\LaravelGoogleIndexing\Facades\LaravelGoogleIndexingFacade as LaravelGoogleIndexing; LaravelGoogleIndexing::status('https://www.my-domain.com')
Without using the Facade
You can also use the class directly:
use Elfeffe\LaravelGoogleIndexing\LaravelGoogleIndexing; (new LaravelGoogleIndexing)->update('https://www.my-domain.com')
For dealing with multiple urls, you can pass an array with multiple updated/deleted urls:
use Elfeffe\LaravelGoogleIndexing\Facades\LaravelGoogleIndexingFacade as LaravelGoogleIndexing; LaravelGoogleIndexing::multiplePublish([ ['URL_UPDATED' => 'https://www.site.com'], ['URL_DELETED' => 'https://www.site.com/deleted-url'] ])
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email info@neoteo.com instead of using the issue tracker.
Credits
- Federico Reggiani (Current maintainer)
- Robin Dirksen (Original developer)
- Famdirksen (Original company)
- All Contributors
License
The MIT License (MIT). Please see License File for more information.