[英]how to publish vendor from package Laravel 5
So I've my custom Laravel 5.4 package, and i want to publish the vendor packages located into my package, this is my code (PackageServiceProvider.php): 因此,我有我的自定义Laravel 5.4程序包,并且我想将供应商程序包发布到我的程序包中,这是我的代码(PackageServiceProvider.php):
$this->publishes([
__DIR__.'/../vendor/soundasleep' => public_path('soundasleep'),
], 'html2text');
but when i run php artisan vendor:publish --tag=html2text
the vendor is published into public folder and i want to be published into my application vendor, because when i tried use \\Html2Text\\Html2Text as html2text;
但是当我运行
php artisan vendor:publish --tag=html2text
卖主被发布到公用文件夹 ,我想发布到我的应用程序供应商,因为当我试图use \\Html2Text\\Html2Text as html2text;
into my package routes.php
i got class Html2Text\\Html2Text not found
. 进入我的包
routes.php
我得到了class Html2Text\\Html2Text not found
。
this is my composer : 这是我的作曲家:
"require": {
"soundasleep/html2text": "~0.5"
}
[ I wondered if there is some thing like vendor_path
] [ 我想知道是否有诸如
vendor_path
类的 vendor_path
]
so please if someone has any idea i'll be very appreciative. 因此,如果有人有任何想法,我会非常感激。
First, you need to register your package in config/app.php
. 首先,您需要在
config/app.php
注册您的软件包。 Add it to the providers array. 将其添加到providers数组。
Html2Text\\Html2Text\\PackageServiceProvider.php::class,
Third party packages should publish config files into the config directory. 第三方软件包应将配置文件发布到config目录中。 In your service provider, you publish it to the public folder
public_path('soundasleep')
. 在您的服务提供商中,将其发布到公用文件夹
public_path('soundasleep')
。
Change it to config_path('soundasleep')
. 将其更改为
config_path('soundasleep')
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.