douzhi2012 2018-05-06 23:25
浏览 286

如何在自定义php项目中运行composer包

I have downloaded php phantom js using composer but I am not able to run this package in my php project. Is there any other requirements or engine needed to run composer package on custom php project. I have this folder structure

enter image description here

I am getting this error

Fatal error: Class 'JonnyW\PhantomJs\Client' not found in D:\wamp\www\freelancer\practice\phantomget.php on line 5

because it is not getting the class

I have also change the class inclusion use JonnyW\PhantomJs\Client; to include_one('Client class path in vendor folder') to directly get the class but it is showing other class errors

So is there any workaround to use this package on custom php project, I have this package here enter image description here

  • 写回答

1条回答 默认 最新

  • dongtuo0828 2018-05-07 11:31
    关注

    Till now I have not received any response regarding this question but finally I have found a solution by myself and this is my achievement. So hope this will help others in future.

    So we only need to include one file and it will do all the stuff so you need to include this in your php file where you want to use the package and it will run the package files. Wherever you want to use the package class you can include this code in your file and enjoy.

    require __DIR__ . '/vendor/autoload.php';

    Thanks to me.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器