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 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用