Php 在Laravel的Vinelab/minion中获取无效的提供程序异常
我使用插件在我的Php 在Laravel的Vinelab/minion中获取无效的提供程序异常,php,laravel-4,Php,Laravel 4,我使用插件在我的客户端应用程序(angularjs)中从服务器(Laravel 4.2)获取通知,我在客户端实现,但当我在Laravel中实现Vinelab/minion库并试图通过调用php artisan minion:run来运行minion时,它会给我类似的错误 [Vinelab\Minion\InvalidProviderException] Provider Vinelab\Minion\ChatProvider must be an instance of \Vinelab\Mi
客户端应用程序(angularjs)
中从服务器(Laravel 4.2)
获取通知,我在客户端实现,但当我在Laravel
中实现Vinelab/minion
库并试图通过调用php artisan minion:run
来运行minion时,它会给我类似的错误
[Vinelab\Minion\InvalidProviderException]
Provider Vinelab\Minion\ChatProvider must be an instance of \Vinelab\Minion\Provider
我的目录结构:
app/
config/
packages/
vinelab/
minion/
minion.php
providers/
ChatProvider.php
vendor/
在app/config/packages/vinelab/minion/minion.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Router Realm
|--------------------------------------------------------------------------
|
| The realm that the router should use.
|
*/
'realm' => 'minion',
/*
|--------------------------------------------------------------------------
| Router Host
|--------------------------------------------------------------------------
|
| The IP or hostname that the router should run under.
|
*/
'host' => '127.0.0.1',
/*
|--------------------------------------------------------------------------
| Router Port
|--------------------------------------------------------------------------
|
| The port that should be used by the router.
|
*/
'port' => 9090,
/*
|--------------------------------------------------------------------------
| Auto-registered Providers
|--------------------------------------------------------------------------
|
| The providers listed here will be automatically registered on the
| session start of the router, in return their role is to register RPCs,
| subscribe and publish to topics and pretty much whatever an Internal Client does.
|
*/
'providers' => [
'ChatProvider'
],
'debug' => true,
];
这是我的扩展类
<?php
namespace Chaospower\Messaging\Provider;
use Vinelab\Minion\Provider;
use Auth;
class ChatProvider extends Provider
{
protected $prefix = 'com.';
public function boot()
{
// will be registered to topic: chat.send
$this->register(Config::get('site.domain').'.message', 'sendMessage');
}
public function setPrefix($prefix)
{
$this->prefix = $prefix;
}
public function sendMessage($args, $data)
{
$message = $data->message;
// store message in the database?
// tell everyone about it
$this->publish('message', compact('message'));
// response with the status
return true;
}
}
$this->register
与订阅不同。这是一个远程方法调用过程
如果您需要订阅$this->subscribe('message','callbackfunction')
,那么它将从thruway准备onMessage函数
您可以将提供者设置为远程过程注册者,也可以订阅主题。session.call sendMessage当您需要发送邮件时
<?php
namespace Chaospower\Messaging\Provider;
use Vinelab\Minion\Provider;
use Auth;
class ChatProvider extends Provider
{
protected $prefix = 'com.';
public function boot()
{
// will be registered to topic: chat.send
$this->register(Config::get('site.domain').'.message', 'sendMessage');
}
public function setPrefix($prefix)
{
$this->prefix = $prefix;
}
public function sendMessage($args, $data)
{
$message = $data->message;
// store message in the database?
// tell everyone about it
$this->publish('message', compact('message'));
// response with the status
return true;
}
}
vagrant@homestead:~/Code/Laravel$ php artisan minion:run --register="Chaospower\Messaging\Provider\ChatProvider"
▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▀▀═════════════▀▀▄
█═══════════════════█
█═════════════════════█
█═══▄▄▄▄▄▄▄═══▄▄▄▄▄▄▄═══█
█═══█████████═█████████═══█
█══██▀ ▀█████▀ ▀██══█
██████ █▀█ ███ █▀█ ██████
██████ ▀▀▀ ███ ▀▀▀ ██████
█══▀█▄ ▄██ ██▄ ▄█▀══█
█════▀█████▀ ▀█████▀════█
█═════════════════════════█
█═════════════════════════█
█═══════▀▄▄▄▄▄▄▄▄▄▀═══════█
█═════════════════════════█
▐▓▓▌═════════════════════▐▓▓▌
▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█
█══█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█══█
▄█══█▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌█══█▄
█████▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌ █████
██████▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌ ██████
▀█▀█ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌ █▀█▀
▐▓▓▓▓▓▓▌▐▓▓▓▓▓▓▌
▐▓▓▓▓▌ ▐▓▓▓▓▌
▄████▀ ▀████▄
▀▀▀▀ ▀▀▀▀
2015-03-10T08:27:58.5390490 info [Vinelab\Minion\Client 5446] New client created
2015-03-10T08:27:58.5467130 info [Thruway\Transport\PawlTransportProvider 5446] Starting Transport
2015-03-10T08:27:58.7215050 info [Thruway\Transport\PawlTransportProvider 5446] Pawl has connected
2015-03-10T08:27:58.8066330 debug [Thruway\Transport\PawlTransportProvider 5446] Received: [2,837176922,{"authrole":"anonymous","authmethod":"anonymous","roles":{"broker":{"features":{"publisher_identification":true,"publisher_exclusion":true,"pattern_based_subscription":true,"subscription_meta_api":true,"subscriber_blackwhite_listing":true}},"dealer":{"features":{"progressive_call_results":true,"pattern_based_registration":true,"registration_meta_api":true,"shared_registration":true,"caller_identification":true}}},"authid":"RK7RIery7evd71THp_Kzcx3h"}]
2015-03-10T08:27:58.8109340 debug [Vinelab\Minion\Client 5446] Client onMessage: [Thruway\Message\WelcomeMessage]
2015-03-10T08:27:58.8110330 info [Vinelab\Minion\Client 5446] We have been welcomed...
2015-03-10T08:27:58.8292430 debug [Thruway\Transport\PawlTransportProvider 5446] Received: [65,1474724289953122,1308617500]
2015-03-10T08:27:58.8347220 debug [Vinelab\Minion\Client 5446] Client onMessage: [Thruway\Message\RegisteredMessage]
2015-03-10T08:27:58.8350070 info [Thruway\Role\Callee 5446] Setting registration_id for com.leadrm.app.message (0)
2015-03-10T08:27:58.8354950 debug [Thruway\Transport\PawlTransportProvider 5446] Received: [33,2002512864967000,1374387471]
2015-03-10T08:27:58.8401330 debug [Vinelab\Minion\Client 5446] Client onMessage: [Thruway\Message\SubscribedMessage]
2015-03-10T08:28:05.0705930 debug [Thruway\Transport\PawlTransportProvider 5446] Received: [36,1374387471,1952879835,{},["test"]]
2015-03-10T08:28:05.0930590 debug [Vinelab\Minion\Client 5446] Client onMessage: [Thruway\Message\EventMessage]
2015-03-10T08:36:11.6339470 debug [Thruway\Transport\PawlTransportProvider 5446] Received: [36,1374387471,1879215773,{},["test"]]
2015-03-10T08:36:11.6341770 debug [Vinelab\Minion\Client 5446] Client onMessage: [Thruway\Message\EventMessage]
2015-03-10T08:36:18.9851460 debug [Thruway\Transport\PawlTransportProvider 5446] Received: [36,1374387471,851409442,{},["test"]]
2015-03-10T08:36:18.9854340 debug [Vinelab\Minion\Client 5446] Client onMessage: [Thruway\Message\EventMessage]