Fix SDK autoloader path for Twilio namespace
All checks were successful
Create Release / build (push) Successful in 3s
All checks were successful
Create Release / build (push) Successful in 3s
The SDK files are at twilio/sdk/Twilio/Rest/Client.php but the autoloader was looking at twilio/sdk/Rest/Client.php. Fixed by using the full class name in the path instead of stripping the Twilio\ prefix. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,16 +77,16 @@ if (!defined('TWILIO_AUTOLOADER_REGISTERED')) {
|
||||
if (strpos($class, 'Twilio\\') !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Convert class name to file path
|
||||
$relative_class = substr($class, 7); // Remove 'Twilio\'
|
||||
$file = __DIR__ . '/twilio/sdk/' . str_replace('\\', '/', $relative_class) . '.php';
|
||||
|
||||
// The SDK structure is: twilio/sdk/Twilio/Rest/Client.php for Twilio\Rest\Client
|
||||
$file = __DIR__ . '/twilio/sdk/' . str_replace('\\', '/', $class) . '.php';
|
||||
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -98,10 +98,10 @@ if (!defined('TWILIO_AUTOLOADER_REGISTERED')) {
|
||||
|
||||
// Load essential Twilio classes manually to ensure they're available
|
||||
$essential_classes = [
|
||||
__DIR__ . '/twilio/sdk/Rest/Client.php',
|
||||
__DIR__ . '/twilio/sdk/TwiML/VoiceResponse.php',
|
||||
__DIR__ . '/twilio/sdk/Exceptions/TwilioException.php',
|
||||
__DIR__ . '/twilio/sdk/Security/RequestValidator.php'
|
||||
__DIR__ . '/twilio/sdk/Twilio/Rest/Client.php',
|
||||
__DIR__ . '/twilio/sdk/Twilio/TwiML/VoiceResponse.php',
|
||||
__DIR__ . '/twilio/sdk/Twilio/Exceptions/TwilioException.php',
|
||||
__DIR__ . '/twilio/sdk/Twilio/Security/RequestValidator.php'
|
||||
];
|
||||
|
||||
foreach ($essential_classes as $class_file) {
|
||||
|
||||
Reference in New Issue
Block a user