Download the PHP package artisanpack-ui/google without Composer

On this page you can find all versions of the php package artisanpack-ui/google. 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 google

ArtisanPack UI Google

Shared Google OAuth2 authentication, token storage/refresh, and scope management that powers ArtisanPack UI's Google service integrations. Provider packages like artisanpack-ui/analytics-google, artisanpack-ui/google-search-console, and artisanpack-ui/google-tag-manager sit on top of this package.

What this package does

artisanpack-ui/google is the shared plumbing that every ArtisanPack UI Google integration sits on top of. It owns:

Service packages (Analytics, Search Console, Tag Manager, …) declare the scopes they need and, once a user has connected, call Google::tokens()->getValidAccessToken( $connection ) to make authenticated API calls. They never handle OAuth themselves.

Installation

The service provider and Google facade are auto-discovered.

Publish and run migrations to create the google_configurations and google_connections tables:

Optionally publish the config file to customize routes, drivers, or endpoints:

Optional peer packages

Package What it enables
livewire/livewire ^3.6 The <livewire:google-connection-manager /> connect/disconnect/status UI.
artisanpack-ui/cms-framework The cms credential driver — stores credentials via the CMS Settings module.

Neither is required; the base package boots and works without them.

Google Cloud Console setup

  1. Open the Google Cloud Console and create (or select) a project.
  2. Navigate to APIs & Services → OAuth consent screen. Choose External unless every user has a Workspace account on the same domain, then fill in the app name, support email, and developer contact.
  3. Under Scopes, add every scope your installed service packages require. Consent screens for external apps in "Testing" mode are limited to added test users; publish the app when you're ready for production traffic.
  4. Enable the APIs your service packages depend on (Analytics Data API, Search Console API, Tag Manager API, …) under APIs & Services → Library.
  5. Go to APIs & Services → Credentials → Create Credentials → OAuth client ID.
    • Application type: Web application
    • Authorized redirect URI: https://your-app.test/google/auth/callback (adjust prefix if you change google.routes.prefix).
  6. Copy the generated Client ID and Client secret.
  7. Save them into whichever credential driver you've chosen (see below).

Credential storage

artisanpack-ui/google supports three credential storage drivers. Choose one by setting GOOGLE_CONFIG_DRIVER (or config('google.driver')).

config (default)

Reads credentials from config/google.php / .env. Best for single-tenant apps where credentials belong in the deploy pipeline:

The config driver is read-only; Google::config()->save() throws.

database

Stores credentials in the google_configurations table. The client secret is encrypted with Laravel's Encrypter (APP_KEY) before it is written. Good for multi-tenant apps or admin-UI-managed credentials:

If you rotate APP_KEY without re-encrypting the stored secret, the driver logs a warning and treats the row as unconfigured.

cms (optional, requires artisanpack-ui/cms-framework)

Delegates get/set to the CMS framework's Settings module, so Google credentials live alongside every other site-level setting:

The client secret is encrypted before it is passed to apUpdateSetting(). Reading and writing goes through apGetSetting() / apUpdateSetting(), so any Settings API a project already exposes can manage these credentials. If the CMS framework is not installed, the driver's setting keys are simply never registered — you get a clear "not configured" state instead of a hard boot error.

Connecting a user

The base package ships two web routes (mounted under google.routes.prefix, default /google/auth) and two more added for incremental consent and disconnection:

Route Method Name
/connect GET google.auth.connect
/callback GET google.auth.callback
/reauthorize GET google.auth.reauthorize
/disconnect POST google.auth.disconnect

Send an authenticated user to route('google.auth.connect'):

The controller redirects them to Google's consent screen, they return to /callback, the code is exchanged, and a GoogleConnection row is written for the authenticated user. Redirects afterwards honor google.routes.redirect_after_connect and google.routes.redirect_after_error.

Registering scopes from a service package

Service packages contribute scopes via the ap.google.scopes filter hook (from artisanpack-ui/hooks):

At consent time the base package unions every contributed scope with the baseline (openid, userinfo.email, userinfo.profile) and de-duplicates. A single consent screen covers every dependent service — users don't get a per-package prompt.

Applications that need to add a scope without a service provider can call Google::scopes()->register( $scope ) at runtime instead.

Incremental consent

When a new service package is installed after the account is already connected, the scope registry starts returning scopes the connection doesn't hold. The connection-management component surfaces a Reauthorize action; the google.auth.reauthorize route hits OAuthManager::reauthorizationUrl() and asks Google for only the missing scopes with include_granted_scopes=true — Google merges the new grant with the existing one so the user isn't reprompted for scopes they've already approved.

If your app has its own UI, call the manager directly:

Connection-management UI

The package ships three interchangeable connection-management components — one Livewire, one React, one Vue — all backed by the same routes and JSON status endpoint. Each shows:

Scope-limited to connect / disconnect / status by design — no per-service enable/disable toggles.

Livewire

If livewire/livewire is installed, mount:

React

The React and Vue components ship as source under resources/js/ — no prebuilt npm package. Either publish the assets into your app's tree:

…or point your bundler at the package directly. Then import:

Props (all optional):

Prop Type Default Purpose
statusUrl string /google/auth/status Override the status endpoint if you've changed google.routes.prefix.
csrfToken string \| null Read from <meta name="csrf-token"> Sent as X-CSRF-TOKEN on the disconnect POST.
onDisconnected () => void Fires after a successful disconnect.
onStatusChanged (status) => void Fires whenever the status payload refreshes.
className string Appended to the root element's class.

Vue 3

Props and emits mirror the React component; see the source for the exact shape.

Building your own

The React and Vue components are a convenience. Any UI framework can consume:

The same status payload the JS components consume is what the shared resources/js/shared/api.ts module type-encodes — use it as a reference for your own client.

Making API calls

Service packages retrieve a valid access token via the token manager. It refreshes transparently when the current token is within 60 seconds of expiring, and marks the connection disconnected on invalid_grant:

Configuration reference

Key options in config/google.php:

Key Default Meaning
client_id / client_secret / redirect_uri env(...) Credentials used by the config driver.
driver config Credential driver: config, database, or cms.
endpoints.authorize Google auth URL Overridable for testing.
endpoints.token Google token URL Overridable for testing.
routes.enabled true Set false to skip the built-in web routes.
routes.prefix google/auth Prefix for the four package routes.
routes.middleware ['web'] Middleware applied to the built-in routes.
routes.redirect_after_connect / Path or route name to send users to after connect/disconnect.
routes.redirect_after_error / Path or route name for OAuth errors.
user_model App\Models\User The user model GoogleConnection belongs to.

Contributing

Please read through the contributing guidelines to learn more about how you can contribute to this project.


All versions of google with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/encryption Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.5
artisanpack-ui/core Version ^1.0
artisanpack-ui/hooks Version ^1.2
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 artisanpack-ui/google contains the following files

Loading the files please wait ...