我为laravel创建了一个名为zoho的PHP包。
namespace rahulreghunath\zoho;
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
class ServiceProvider extends IlluminateServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/../config/zoho.php' => config_path('zoho.php'),
]);
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
}
和作曲家文件是
{
"name": "rahulreghunath/zoho",
"minimum-stability": "dev",
"require": {
},
"description": "PHP form validation plugin ",
"homepage": "https://github.com/rahulreghunath/zoho-crm",
"license": "MIT",
"authors": [
{
"name": "Rahul Reghunath",
"email": "reghunath11@gmail.com",
"role": "developer"
}
]
}
当我创建时,包工作正常,不在供应商文件夹中但是在我的时候 提交给Packagist并使用composer进行安装,它显示错误
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'rahulreghunath\zoho\ServiceProvider' not found
运行vendot:publish命令时
即使提供商rahulreghunath\Zoho\ServiceProvider::class,
添加到config / app.php
是composer文件中自动加载的任何错误 无论如何,提前谢谢
答案 0 :(得分:0)
自己找到答案
将composer.json更改为
{
"name": "rahulreghunath/zoho",
"description": "Zoho CRM integration for PHP-Laravel",
"license": "MIT",
"keywords": ["laravel", "zoho"],
"authors": [
{
"name": "Rahul Reghunath",
"email": "reghunath11@gmail.com",
"role": "developer"
}
],
"require": {
"php": ">=5.5.9"
},
"autoload": {
"psr-4": {
"Rahulreghunath\\Zoho\\": "src/"
}
},
"minimum-stability": "dev"
}
和服务提供商
Rahulreghunath\Zoho\ServiceProvider::class,