https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
b

breezy-hairdresser-40587

11/15/2023, 7:41 AM
Hi guys, I'm a new developer who just tried to implement the GrowthBook for A/B test purposes. I'm using PHP SDK. This is my composer setup and code implementation. However, I got the error from the first run "*Fatal error: Uncaught Exception: Must set an HTTP Client before loading features*". Saw from the docs "To load features, we require a PSR-17 (HttpClient) and PSR-18 (RequestFactoryInterface) compatible library like Guzzle to be installed.", I have the guzzlehttp installed but still got the error
Copy code
"guzzlehttp/guzzle": "6.5.8",
Could you please help take a look, thank you !
r

rhythmic-agent-34208

11/15/2023, 7:41 AM
Our official support hours are 6:30am - 5pm Pacific Time, Monday through Friday. You may occasionally hear from us outside of these hours. Your support request has been logged in our system. Our support team will get back to you very soon!
Hi, I believe you are missing a few things in the PHP code. This might be the HTTPClient resource that you need:
Copy code
$growthbook = Growthbook\Growthbook::create()
  ->withHttpClient($client, $requestFactory);
And these interfaces:
Copy code
\Psr\Http\Client\ClientInterface $client
\Psr\Http\Message\RequestFactoryInterface $requestFactory
14 Views