doushi1996
2017-07-21 09:28
浏览 264
已采纳

Composer autoload Class not found例外

I create a file named Util.php and there are two class in the Util.php file.

  • class StringUtil {}
  • class ArrayUtil {}

how can I make the Util.php into composer library for other project include? now I got a Class Not Found Exception.

图片转代码服务由CSDN问答提供 功能建议

我创建了一个名为 Util.php 的文件, Util.php 文件。

  • class StringUtil {}
  • class ArrayUtil {}

    如何将 Util.php 转换为 composer library for 其他项目包括? 现在我得到了 Class Not Found Exception

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doubi5520 2017-07-21 10:03
    已采纳

    I create a file named Util.php and there are two class in the Util.php file.

    First of all this is bad practice

    Anyway, it can help: https://getcomposer.org/doc/04-schema.md#files

    {
        "autoload": {
            "files": ["src/MyLibrary/functions.php"]
        }
    }
    
    打赏 评论

相关推荐 更多相似问题