bornfight / yii2-webhooks

MIT License
9 stars 5 forks source link

Can not create a Webhook #6

Open NgesBrian opened 5 years ago

NgesBrian commented 5 years ago

Great job in this project as I will like to use this in my yii2 api to push data eg notifications from the API to any frontend that will make my app real time using webhook. My frontend is in reactjs. I have successfully installed and migrated the package. I have tried to run index.php/webhooks?r=/webhooks/create and I am getting TypeError Return value of degordian\webhooks\Module::validateWebhookClass() must be an instance of degordian\webhooks\void, none returned.

Al line 62 of /vendor/degordian/yii2-webhooks/src/Module.php.

I am using Yii2 Advance and I have created it as an API.

Here is part of my config/main.php

'bootstrap' => ['log', 'webhooks'], 'modules' => [ 'v1' => [ 'basePath' => '@app/modules/v1', 'class' => 'api\modules\v1\Module', ], 'webhooks' => [ 'class' => 'degordian\webhooks\Module', 'eventDispatcherComponentClass' => 'app\components\MyDispatcher', ], ],

Please is the error coming from my end and How do I fix this ??

napravicukod commented 5 years ago

You need to update your php version, dependency is php >= 7.1 If it is out of your control, you can fork the repo and remove all the php >= 7.1 specifics in the code

NgesBrian commented 5 years ago

I have updated my php version to 7.1.27 but I still get this error. I have forked the project and I cant see any php>=7.1 anywhere. Can help with an example file ?? Please what can I do to solve the issue

napravicukod commented 5 years ago

There is a dependency inside the composer.json file. Please uninstall the package

composer remove degordian/yii2-webhooks

and then install the package from dev-master:

composer require --prefer-dist degordian/yii2-webhooks "dev-master"

I have tried with php 7.1.25 and a clean yii2-advanced template and everything seems fine.

If you dont have your own EventDispatcher class, remove the

'eventDispatcherComponentClass' => 'app\components\MyDispatcher',

from config

If this doesn't help, let me know.

NgesBrian commented 5 years ago

there is a bug trying to install this package using the above command. Potential causes: