PHPackages                             adnanhussainturki/google-my-business-php - 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. adnanhussainturki/google-my-business-php

ActiveLibrary

adnanhussainturki/google-my-business-php
========================================

A GOTO PHP Wrapper for GoogleMyBusiness

0.1(5y ago)2150[1 issues](https://github.com/AdnanHussainTurki/GoogleMyBusiness/issues)MITPHP

Since Jan 28Pushed 5y ago2 watchersCompare

[ Source](https://github.com/AdnanHussainTurki/GoogleMyBusiness)[ Packagist](https://packagist.org/packages/adnanhussainturki/google-my-business-php)[ RSS](/packages/adnanhussainturki-google-my-business-php/feed)WikiDiscussions master Synced 2d ago

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

GoogleMyBusiness API PHP Wrapper
================================

[](#googlemybusiness-api-php-wrapper)

Google privately provides its GoogleMyBusiness API to the developers. Being private, the SDK for this API is not available in the [Google Services PHP SDK](https://github.com/googleapis/google-api-php-client "Google Services PHP SDK"). This projects provides a goto and easy to implement way to use GoogleMyBusiness API.

### Requesting Access

[](#requesting-access)

Being private API, you need to request access to the same API via the following [form](https://developers.google.com/my-business/content/prereqs "form") for your Google project. You may need to provide your project id and use case.

### Credentials

[](#credentials)

Once your API request got approved, you need to generate credentials i.e client\_id and client\_secret. With that, you also need to generate refresh token for the following scope

`https://www.googleapis.com/auth/business.manage`

If you dont know much about how to refresh token, follow the instruction below:

- While generating credentials in Google Developer Console for your API, enter `https://google.myphpnotes.com` in authorised javascript field and `https://google.myphpnotes.com/callback.php` in the redirect\_uri filed.
- Then, go to `https://google.myphpnotes.com`
- Provide your client id and client secret in the given field and add scope as following `
- On submission, you will be requested to authorize access to your Google account. Select the respective account and allow the given scope.
- On redirection, you will get several important information like access\_token and refresh token.
- Note down the refresh token from that.

### Installation

[](#installation)

You can install this library to your project via composer using the following command:

`composer require adnanhussainturki/google-my-business-php`

### List Accounts

[](#list-accounts)

The GMB works something like this. Your Google Account have many accounts (usually one) and each account contains multiple locations. `

```
$gmb = new GoogleMyBusiness("APP_KEY", "APP_SECRET");
$gmb->setRefreshToken("_REFRESH_TOKEN_");

$account = new Account();
$account->provideClient($gmb);

$accounts = $account->list();
$firstAccount = $accounts[0];`

```

### List Locations

[](#list-locations)

```
$gmb = new GoogleMyBusiness("APP_KEY", "APP_SECRET");
$gmb->setRefreshToken("_REFRESH_TOKEN_");

$account = new Account();
$account->provideClient($gmb);

$accounts = $account->list();
$firstAccount = $accounts[0];

$locations = $accounts[0]->locations();
$firstLocation = $locations[0];

```

### List Location Posts

[](#list-location-posts)

```
$gmb = new GoogleMyBusiness("APP_KEY", "APP_SECRET");
$gmb->setRefreshToken("_REFRESH_TOKEN_");

$account = new Account();
$account->provideClient($gmb);

$accounts = $account->list();
$firstAccount = $accounts[0];

$locations = $accounts[0]->locations();
$firstLocation = $locations[0];

$posts = $firstLocation->posts();
$firstPost = $posts[0];

```

### List Location Medias

[](#list-location-medias)

```
$gmb = new GoogleMyBusiness("APP_KEY", "APP_SECRET");
$gmb->setRefreshToken("_REFRESH_TOKEN_");

$account = new Account();
$account->provideClient($gmb);

$accounts = $account->list();
$firstAccount = $accounts[0];

$locations = $accounts[0]->locations();
$firstLocation = $locations[0];

$posts = $firstLocation->posts();
$firstPost = $posts[0];

$medias = $firstLocation->medias();
$firstMedia = $medias[0];

```

### Create Media

[](#create-media)

```
$media = new Media;
$media->provideClient($gmb); // GoogleMyBusiness Client for making credentials available to the media class.
$media->setLocationId($firstLocation->getLocationId()); // Location ID
$media->setCategory("ADDITIONAL");
$media->setFormat('PHOTO');
$media->setSourceUrl("https://cdn.torksky.com/projects/torksky_control/production/products/06019E50K0/ff37c4a25fcf48975831153cc376dfdd.jpeg");
$media->setDescription("Bosch GAS 15");
$media = $media->create();

```

### Create Post

[](#create-post)

```
$post = new Post;
$post->provideClient($gmb);
$post->setLocationId($firstLocation->getLocationId());
$post->setCallToAction("ORDER", "https://torksky.com/catalogue/70d1f7b121c397fafc00c6127e7d14c2/view");
$post->setName("Bosch GAS 15");
$post->setDescription("Bosch GAS 15 order now");
$post->setLanguageCode("en");
$post->addMedia($media);
$post->create();

```

### Limitations

[](#limitations)

###### By API

[](#by-api)

- You cannot add products
- You cannot add offer in posts
- You cannot add more than one media in the post
- There may other limitations also. You may let us know about it.

###### By Library

[](#by-library)

This library only concerns for following functions (as of now)

- List Accounts
- List Locations
- List Posts of each location
- List Medias of each location
- Create media for a location
- Create post for a location
- Feel free to contribute/raise issue.

### Buy me a coffee

[](#buy-me-a-coffee)

[![](https://camo.githubusercontent.com/d3859de9dc3552bf4a9a2a4bd5c658f5c5a2608894e3decf740ad123044f8bc6/68747470733a2f2f696d672e6275796d6561636f666665652e636f6d2f6170692f3f75726c3d6148523063484d364c79397062576375596e5635625756685932396d5a6d566c4c6d4e766253396863476b765032356862575539595752755957353064584a7261535a7a6158706c50544d774d435a695a7931706257466e5a54316962574d6d596d466a61326479623356755a44316d5a6a67784d32593d2663726561746f723d61646e616e7475726b692669735f6372656174696e673d6275696c64696e67253230636f6f6c2532307468696e6773253230657665727925323073696e676c65253230662a2a6b696e672532306461792e2664657369676e5f636f64653d312664657369676e5f636f6c6f723d25323366663831336626736c75673d61646e616e7475726b69)](https://www.buymeacoffee.com/adnanturki)

### How to contribute

[](#how-to-contribute)

- Create a fork, make changes and send a pull request.
- Raise a issue

### License

[](#license)

Licensed under Apache 2.0. You can check its details [here](https://choosealicense.com/licenses/apache-2.0/ "here").

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

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

1931d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f093c06ab5970c00e683078ba0e3d7c27ca37e7ed22c9ee1dd94f318868167e?d=identicon)[AdnanHussainTurki](/maintainers/AdnanHussainTurki)

---

Top Contributors

[![AdnanHussainTurki](https://avatars.githubusercontent.com/u/24974673?v=4)](https://github.com/AdnanHussainTurki "AdnanHussainTurki (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adnanhussainturki-google-my-business-php/health.svg)

```
[![Health](https://phpackages.com/badges/adnanhussainturki-google-my-business-php/health.svg)](https://phpackages.com/packages/adnanhussainturki-google-my-business-php)
```

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

81733.7k](/packages/flow-php-flow)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1225.0k10](/packages/fleetbase-core-api)[chameleon-system/chameleon-base

The Chameleon System core.

1026.5k3](/packages/chameleon-system-chameleon-base)[voidagency/vactory_starter_kit

Vactory is a custom Drupal profile which is developed and released by VOID Agency.

1019.7k](/packages/voidagency-vactory-starter-kit)

PHPackages © 2026

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