PHP-intercom not working after updating composer

你。 提交于 2020-01-06 16:03:52

问题


i recently updated using composer. After updating I am getting error in php file , where I am sending data to intercom. This is the error :

Fatal error: Class 'Intercom\IntercomBasicAuthClient' not found in <filename>

I found a similar problem here Symfony Exception (Class not found) only on development and production servers. But couldn't understand exactly how to solve the issue. I tried using intercom in Uppercase as well as lowercase, but problem is not solved.

In my installed.json I found this :

"autoload": {
            "psr-4": {
                "Intercom\\": [
                    "src"
                ]
            }
        }

And this is the directory location of intercom files :

/public_html/vendor/intercom/intercom-php/src

When I dig into more composers file(was trying to understand how classes are included and all), I came across this code in autoload_namespaces.json

<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'libphonenumber' => array($vendorDir . '/giggsey/libphonenumber-for-php/src'),
    'PhpAmqpLib' => array($vendorDir . '/php-amqplib/php-amqplib'),
);

libphonenumber and phpamqplib are two libraries that I installed using composer, and intercom is missing here.

So I am totally confused, what is the actual problem. Is the intercom library missing in autoload_namespace or is it the uppercase-lowercase issue or what.

Edit :

This I found in autoload_psr4.php

<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
    'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
    'Intercom\\' => array($vendorDir . '/intercom/intercom-php/src'),
    'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
    'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
    'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
    'Aws\\' => array($vendorDir . '/aws/aws-sdk-php/src'),
);

And this is how I am including Intercom in my php file :

use Intercom\IntercomBasicAuthClient;

回答1:


I figured it out myself. The problem was with PHP version. I am using php-5.5 and the intercom library strictly requires PHP version >= 5.6 .

Created my own library using Intercom APIs to get it work for php-5.5.



来源:https://stackoverflow.com/questions/38832607/php-intercom-not-working-after-updating-composer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!