Open Boffice opened 2 years ago
Hi @Boffice, could you provide a code sample to reproduce the problem? I was not able to replicate the issue.
Thanks.
private static function getDriver()
{
static $driverInstance = null;
if ($driverInstance !== null) {
return $driverInstance;
}
$container = new \Pimple\Container([
'driver' => [
'url' => '*',
'login_id' => '*',
'password' => '*',
]
]);
$driverInstance = new Driver($container);
$driverInstance->authenticate();
return $driverInstance;
}
public function add_user()
{
$driver = $this->getDriver();
//Add a new user
$result = $driver->getUserModel()->createUser([
'email' => 'test@test.com',
'username' => 'test',
'password' => 'testpsw'
]);
echo $this->print($result);
}
Hi @Boffice, I can not replicate your problem, it seems ok to me. Plus, I did not figure out how is possible to have that kind of error since this library do not use any Laravel package.
I may suggest you to verify where you are using the Illuminate\Container\Container
, and try to follow the error stack trace to get to the source of the problem. Let me know if you need any help with this.
If you are using this library whithin Laravel, maybe you can find more suitable the Laravel Mattermost Driver.
Looks like psr/container conflicts with Illuminate/container, and i am using Codeigniter. Illuminate/Container is needed for other modules and can't be removed.
That is ok, but how is this related to the php-mattermost-driver? The code you posted can not generate that kind of error.
Issue appears once i include require('modules/mattermost/vendor/autoload.php');
to the controller. driver loads psr/container which conflicts with illuminate/container.
even
public function index()
{
echo 'hello world';
}
Returns same error.
Hi @Boffice, sorry for the late response.
Any update on this?
Hello, was not able to get around this issue.
Fatal error: Declaration of Illuminate\Container\Container::has($id) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /vendor/illuminate/container/Container.php on line 169
php 7.4
"gnello/php-mattermost-driver": "^2.15"