如何在没有作曲家的情况下在Laravel项目中使用Laravel库 [英] How to use Laravel libraries in Laravel project without composer

查看:62
本文介绍了如何在没有作曲家的情况下在Laravel项目中使用Laravel库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些以前经常使用的库,并且必须能够使用我以前在本地下载的版本将其添加到Laravel项目中,并且可能在没有互联网连接的情况下使用它 是否可以通过Composer之类的方式将其添加到Laravel,还是可以构建自己的本地Composer?

I have libraries which I used to use repeatedly and have to be able to add it to Laravel project with the version I already download it before on local and may use it event with no internet connection is it possible to add it to Laravel in some way like Composer or is it possible to build my own local composer?

推荐答案

您可以使用自动加载映射来实现此目的.只需使用您要使用的文件创建一个文件夹.例如:

You can use the autoload mapping in order to adchieve that. Just create a folder with the file/files that you want to use. For example:

YourProject/app/MyClasses/

然后将文件存储在此处.然后,您只需要使用作曲家的类映射即可:编辑composer.json文件,指示您的类的路径:

And store the files right there. Then you just have to use the composer classmap: Edit the composer.json file indicating the path to your classes:

"autoload": {
    ...
    "classmap": [
        "database/seeds",
        "database/factories"
        "app/MyClasses"
    ],
    ...
},

运行composer dump-autoload命令,您就可以开始使用.

Run the composer dump-autoload command and you'll be ready to go.

这篇关于如何在没有作曲家的情况下在Laravel项目中使用Laravel库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆