{"id":20760258,"url":"https://github.com/spotonlive/php-google-my-business","last_synced_at":"2025-08-21T22:31:10.104Z","repository":{"id":57057183,"uuid":"96886735","full_name":"spotonlive/php-google-my-business","owner":"spotonlive","description":"Google MyBusiness","archived":false,"fork":false,"pushed_at":"2020-04-28T06:19:04.000Z","size":65,"stargazers_count":29,"open_issues_count":10,"forks_count":25,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-13T04:41:02.919Z","etag":null,"topics":["google-my-business","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spotonlive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-11T11:39:29.000Z","updated_at":"2024-06-26T00:15:48.000Z","dependencies_parsed_at":"2022-08-24T14:53:02.493Z","dependency_job_id":null,"html_url":"https://github.com/spotonlive/php-google-my-business","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotonlive%2Fphp-google-my-business","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotonlive%2Fphp-google-my-business/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotonlive%2Fphp-google-my-business/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotonlive%2Fphp-google-my-business/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spotonlive","download_url":"https://codeload.github.com/spotonlive/php-google-my-business/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230138101,"owners_count":18179174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-my-business","php"],"created_at":"2024-11-17T10:12:51.357Z","updated_at":"2024-12-20T05:08:38.108Z","avatar_url":"https://github.com/spotonlive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-google-my-business\nGoogle MyBusiness\n\n## Examples\n\n### Creating a new post\n```\n$post_body = new \\Google_Service_MyBusiness_LocalPost;\n$post_body-\u003esetLanguageCode('en');\n$post_body-\u003esetSummary('test'); // post text\n$call = new \\Google_Service_MyBusiness_CallToAction;\n$call-\u003esetActionType('LEARN_MORE'); // call to action type, see https://developers.google.com/my-business/content/posts-data#call_to_action_posts\n$call-\u003esetUrl('https://xxxxxx'); // URL to link to\n$post_body-\u003esetCallToAction($call);\n$media = new \\Google_Service_MyBusiness_MediaItem;\n$media-\u003esetMediaFormat('PHOTO');\n$media-\u003esetSourceUrl('https://example.com/whatever.jpg'); // needs to be 10+k, GIFs are *not* supported\n$post_body-\u003esetMedia($media);\n$accounts = $service-\u003eaccounts-\u003elistAccounts()-\u003egetAccounts(); // get accounts\n$locations = $service-\u003eaccounts_locations-\u003elistAccountsLocations($accounts[0]['name']); // get locations under first account\n$service-\u003eaccounts_locations_localPosts-\u003ecreate($locations[0]['name'], $post_body); // create post for the location\n```\n\n### Pulling metrics for location\n```\n$accounts = $service-\u003eaccounts-\u003elistAccounts()-\u003egetAccounts();\n$locations = $service-\u003eaccounts_locations-\u003elistAccountsLocations($accounts[0]['name']); // get locations for the first account\n$request = new \\Google_Service_MyBusiness_ReportLocationInsightsRequest;\n$request-\u003esetLocationNames($locations[0]['name']); // set first location to pull data for\n$actions = new \\Google_Service_MyBusiness_BasicMetricsRequest;\n$actions-\u003esetMetricRequests(['metric' =\u003e 'ALL']);\n$time = new \\Google_Service_MyBusiness_TimeRange;\n$time-\u003esetStartTime('2019-10-02T15:01:23.045123456Z');\n$time-\u003esetEndTime('2020-01-31T15:01:23.045123456Z');\n$actions-\u003esetTimeRange($time);\n$request-\u003esetBasicRequest($actions);\n$insights = $service-\u003eaccounts_locations-\u003ereportInsights($accounts[0]['name'], $request);\nprint_r($insights); // see object result structure / insights available\n```\n\n### Driving metrics for a location\n```\n$locations = $service-\u003eaccounts_locations-\u003elistAccountsLocations($accounts[0]['name']);\n$request = new \\Google_Service_MyBusiness_ReportLocationInsightsRequest;\n$request-\u003esetLocationNames($locations[0]['name']);\n$driving = new \\Google_Service_MyBusiness_DrivingDirectionMetricsRequest;\n$driving-\u003esetNumDays(90);\n$request-\u003esetDrivingDirectionsRequest($driving);\n$insights = $service-\u003eaccounts_locations-\u003ereportInsights($accounts[0]['name'], $request);\nprint_r($insights);\n```\n\n### Other examples\n```\n$media = $service-\u003eaccounts_locations_media-\u003elistAccountsLocationsMedia($locations[0]['name']); // media\n$questions=$service-\u003eaccounts_locations_questions-\u003elistAccountsLocationsQuestions($locations[0]['name'])); // questions\n$notifications=$service-\u003eaccounts-\u003egetNotifications($locations[0]['name'])); // get notifications\n$recommended=$service-\u003eaccounts-\u003elistRecommendGoogleLocations($accounts[0]['name']); // recommended locations\n$admins=$service-\u003eaccounts_admins-\u003elistAccountsAdmins($accounts[0]['name'])); // only for business account, not PERSON account\n$reviews=$service-\u003eaccounts_locations_reviews-\u003elistAccountsLocationsReviews($locations[0]['name'])); // get reviews\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotonlive%2Fphp-google-my-business","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspotonlive%2Fphp-google-my-business","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotonlive%2Fphp-google-my-business/lists"}