Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Google Api Laravel Package

tipoff/laravel-google-api

Laravel integration for Google APIs using OAuth client secrets and stored access tokens. Publishes config, reads .env settings, supports service-specific overrides, and includes GMB Account and Key models with built-in policies and Nova resources.

View on GitHub
Deep Wiki
Context7

Laravel Package for tracking Google laravel-google-api

Latest Version on Packagist Tests Total Downloads

This is where your description should go.

Installation

You can install the package via composer:

composer require tipoff/laravel-google-api

You can publish the config file with:

php artisan vendor:publish --provider="Tipoff\GoogleApi\GoogleApiServiceProvider" --tag="google-api-config"

Add the following variables to your .env file and set them based on the contents of the client_secret.json file you obtained from Google.

GOOGLE_CLIENT_ID=
GOOGLE_PROJECT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URIS=
GOOGLE_JAVASCRIPT_ORIGINS=

GOOGLE_API_KEY=

You can use the | character to separate multiple strings in the GOOGLE_REDIRECT_URIS and GOOGLE_JAVASCRIPT_ORIGINS settings.

Obtain an API access token from Google and insert it into the keys table, giving it an identifying slug for the next step. (Make sure that the value field contains your token formatted as valid JSON.)

Set the value of GOOGLE_ACCESS_TOKEN_SLUG in your .env file to the name of the slug in your keys table entry.

Note: If you need to customize the client secret fields or access token value on a service-by-service basis, you may do so by setting values in your .env file for the service-specific values found in config/google-api.php. (For example, YOUTUBE_CLIENT_ID.)

If you do not set service-specific values, it will default to the options set above for each service.

Models

We include the following models:

List of Models

  • GMB Account
  • Key

For each of these models, this package implements an authorization policy that extends the roles and permissions approach of the tipoff/authorization package. The policies for each model in this package are registered through the package and do not need to be registered manually.

The models also have Laravel Nova resources in this package and they are also registered through the package and do not need to be registered manually.

Usage

// Get access token.
$accessToken = GoogleOauth::accessToken('search-console');

// Set access token.
$googleServices = app(GoogleServices::class)->setAccessToken($accessToken);

// Access services.
$searchConsole = $googleServices->searchConsole();
$myBusiness = $googleServices->myBusiness();
$youtube = $googleServices->youtube();
$youtubeAnalytics = $googleServices->youtubeAnalytics();
$analytics = $googleServices->analytics();
$place = $googleServices->places();

Note:

  • The Google Places service makes use of a third-party wrapper to access the Places API. Documentation on available methods for it is available here.
  • The Google Search Console service makes use of a third-party wrapper to access the Laravel Search Console. Documentation on available methods for it is available here.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky