This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods)
please see ourgRPC installation guide.
Authentication
Please see ourAuthentication guidefor more information
on authenticating your client. Once authenticated, you'll be ready to start making requests.
Sample
use Google\Cloud\RecommendationEngine\V1beta1\PredictionServiceClient;
use Google\Cloud\RecommendationEngine\V1beta1\UserEvent;
$client = new PredictionServiceClient();
$formattedName = $predictionServiceClient->placementName(
'[PROJECT]',
'[LOCATION]',
'[CATALOG]',
'[EVENT_STORE]',
'[PLACEMENT]'
);
$userEvent = new UserEvent();
$predictions = $predictionServiceClient->predict($formattedName, $userEvent);
Debugging
Please see ourDebugging guidefor more information about the debugging tools.
Version
This component is considered beta. As such, it should be expected to be mostly stable and we're working towards a release candidate. We will address issues and requests with a higher priority.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [0.8.2 (latest)](/php/docs/reference/cloud-recommendations-ai/latest)\n- [0.8.1](/php/docs/reference/cloud-recommendations-ai/0.8.1)\n- [0.7.7](/php/docs/reference/cloud-recommendations-ai/0.7.7)\n- [0.6.4](/php/docs/reference/cloud-recommendations-ai/0.6.4)\n- [0.5.0](/php/docs/reference/cloud-recommendations-ai/0.5.0)\n- [0.4.12](/php/docs/reference/cloud-recommendations-ai/0.4.12) \n\nGoogle Cloud Recommendations AI for PHP\n=======================================\n\n| **Beta**\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the [launch stage descriptions](/products#product-launch-stages).\n\u003e Idiomatic PHP client for [Google Cloud Recommendations AI](https://cloud.google.com/recommendations-ai).\n\n[](https://packagist.org/packages/google/cloud-recommendations-ai) [](https://packagist.org/packages/google/cloud-recommendations-ai)\n\n**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any\nsupport requests, bug reports, or development contributions should be directed to\nthat project.\n\n### Installation\n\nTo begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/).\n\nNow install this component: \n\n $ composer require google/cloud-recommendations-ai\n\nThis component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods)\nplease see our [gRPC installation guide](https://cloud.google.com/php/grpc).\n\n### Authentication\n\nPlease see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information\non authenticating your client. Once authenticated, you'll be ready to start making requests.\n\n### Sample\n\n use Google\\Cloud\\RecommendationEngine\\V1beta1\\PredictionServiceClient;\n use Google\\Cloud\\RecommendationEngine\\V1beta1\\UserEvent;\n\n $client = new PredictionServiceClient();\n $formattedName = $predictionServiceClient-\u003eplacementName(\n '[PROJECT]',\n '[LOCATION]',\n '[CATALOG]',\n '[EVENT_STORE]',\n '[PLACEMENT]'\n );\n $userEvent = new UserEvent();\n\n $predictions = $predictionServiceClient-\u003epredict($formattedName, $userEvent);\n\n### Debugging\n\nPlease see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)\nfor more information about the debugging tools.\n\n### Version\n\nThis component is considered beta. As such, it should be expected to be mostly stable and we're working towards a release candidate. We will address issues and requests with a higher priority.\n\n### Next Steps\n\n1. Understand the [official documentation](https://cloud.google.com/recommendations-ai/docs)."]]