Hello, new to flarum and its extensions system
I studied code from other extensions but can't seem to get my extension to work locally. Following are the structure and contents of my env
/composer.js
"require": {
...
"flarumx/flarum-ext-user-extra-info": "*@dev"
},
"repositories": [
{ "type": "path", "url": "workbench/*/" }
],
Extension structure:
/workbench
/flarum-ext-user-extra-info
/src
/Listeners
WhatIsLove.php
bootstrap.php
composer.json
/workbench/flarum-ext-user-extra-info/src/composer.json
{
"name": "flarumx/flarum-ext-user-extra-info",
"description": "User extra info shown everywhere",
"type": "flarum-extension",
"require": {
"flarum/core": "^0.1.0-beta.7.1"
},
"autoload": {
"psr-4": {
"Flarumx\\UserExtraInfo\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "User Extra Info"
}
}
}
/workbench/flarum-ext-user-extra-info/bootstrap.php
<?php
namespace Flarumx\UserExtraInfo;
use Illuminate\Contracts\Events\Dispatcher;
return function (Dispatcher $events) {
$events->subscribe(Listeners\WhatIsLove::class);
};
/workbench/flarum-ext-user-extra-info/src/Listeners/WhatIsLove.php
<?php
namespace Flarumx\UserExtraInfo\Listeners;
use Flarum\Event\PostWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class WhatIsLove {
public function subscribe(Dispatcher $events) {
$events->listen(PostWillBeSaved::class, [$this, 'execute']);
}
public function execute(PostWillBeSaved $event) {
$event->post->content = 'Baby don\'t hurt me';
}
}
I can see this entry in /vendor/composer/autoload_psr4.php:
'Flarumx\\UserExtraInfo\\' => array($vendorDir . '/flarumx/flarum-ext-user-extra-info/src'),
However after running php flarum
I get the following error:
PHP Fatal error: Uncaught ReflectionException: Class Flarumx\UserExtraInfo\Listeners\WhatIsLove does not exist in /[mylocaldir]/flarum/vendor/illuminate/container/Container.php:741
Needless to say, theres a 500 on my browser.
If anyone can help me figure out whats wrong, I would be grateful ?