douguan3470 2016-08-08 15:03
浏览 67
已采纳

更新作曲家后,PHP-intercom无法正常工作

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条回答 默认 最新

  • dtjwov4984 2016-10-22 07:25
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块