duanhuang3074 2016-11-27 16:52
浏览 38

在Laravel中包含一个非作曲家的PHP项目

I am trying to use this PHP project RecipeParser in a Laravel project. Aa far as I can tell, it can't be loaded with Composer. It doesn't have any Composer info in the readme, and I can't find it on Packagist either.

I've tried downloading the folder to my /App/ folder and adding it in the controler like this:

include app_path() . '/RecipeParser/bootstrap.php';

But it cannot be found.

I've tried adding the folder in composer like this:

"autoload": {
    "classmap": [
        "database",
        "app/RecipeParser"
    ],
....

and running composer dump-autoload but again it cannot be location.

I've tried adding:

use OneTsp\RecipeParser;

and many variations at the contoller, but doesn't help.

The code I am trying to call it with is

$recipe = RecipeParser::parse($html, $url);

Does it need to be added in config.app somewhere? Is there something specific about this pcakage which means it needs to be included differently? And is there a way to just load it directly from Github,so it gets updated, etc? Normally I can find these in Composer, is there a reason this package isn't?

many thanks

  • 写回答

1条回答 默认 最新

  • drnrxv9383 2016-11-28 12:22
    关注

    After some google, I found relayfoods/recipe-parser (composer based PHP library for parsing recipe data from HTML) same like you require.

    Composer command: composer require relayfoods/recipe-parser Usage:

    $recipe = RecipeParser::parse($html, $url);
    print_r($recipe);
    

    This should work for you.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大