How can I integrate the Mailgun-PHP API with Google App Engine using PHP?

I’m encountering an issue when trying to integrate the Mailgun-PHP API into a Google App Engine environment with PHP. A fatal error occurs stating that the PHP cURL extension is missing, which is required by one of the underlying libraries (resulting in a RuntimeException). I need guidance on how to properly enable the cURL extension in GAE to ensure that the API works as expected. Below is an example of a simple setup check:

<?php
// Check if the cURL extension is active
if (!extension_loaded('curl')) {
    exit('cURL extension is not enabled. Please update your App Engine configuration.');
}

require_once 'vendor/autoload.php';

// Create an instance of a custom mail service handler
$mailHandler = new MGHandler('YOUR_API_KEY', 'api.customdomain.com');
$response = $mailHandler->triggerMail();

echo $response;
?>

During my integration work with Mailgun-PHP on Google App Engine, I hit a similar obstacle regarding the missing cURL extension. My workaround involved checking the PHP runtime version, as some environments require an updated configuration or a custom runtime if the extension is not preloaded. I ended up specifying the necessary extensions in my app.yaml configuration file and ensuring that my deployment environment was based on a flexible setup that allows custom PHP configuration. This approach helped resolve the fatal error while also allowing the mail handler to work smoothly. It is important to check your environment’s compatibility and deploy settings carefully for a proper integration.