netflie / whatsapp-cloud-api

The first PHP API to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform
https://netflie.es/portfolio/whatsapp-business-cloud-api-php-sdk/
MIT License
428 stars 151 forks source link

Error in code... #145

Closed CeloGomesBR closed 8 months ago

CeloGomesBR commented 8 months ago

When we have no ENV variables setted (to disable whatsapp messages), the file WhatsAppCloudApiApp.php do an error in line 38 telling:

Cannot assign null to property Netflie\WhatsAppCloudApi\WhatsAppCloudApiApp::$from_phone_number_id of type string

But, the 'null' is set in your own code!!!

My services.php tried so hard to set empty string, but it´s not solved this issue: 'whatsapp' => [ 'from-phone-number-id' => env('WHATSAPP_ID', '')??'', 'token' => env('WHATSAPP_TOKEN', '')??'', ],

I need an easy way to enable/disable WhatsApp messages in project. The fastest way is #comment lines in env file. But it´s not work because we got this error.

aalbarca commented 8 months ago

Hi @CeloGomesBR fixed in the release will be released today.

See https://github.com/netflie/whatsapp-cloud-api/pull/152