signalwire-community / signalwire-php

PHP Library for SignalWire APIs
https://signalwire-community.github.io/docs/php/
MIT License
22 stars 25 forks source link

Class 'Twilio\Rest\Fax' not found #123

Closed SohrabZ closed 1 year ago

SohrabZ commented 2 years ago

We recently started receiving this error:

Class 'Twilio\Rest\Fax' not found

From Signalwire PHP driver. Is there a fix to this? It's causing issues for us.

ziagit commented 2 years ago

Dear sohrabz, did you found the solution?

SohrabZ commented 2 years ago

We forked the project and removed the deprecated parts: https://github.com/aloware/signalwire-php

ziagit commented 2 years ago

Could you share how to send a message? in Laravel Before I was doing like following

use SignalWire\Rest\Client;
public function send(){
 $client = new Client(
            'project_id'
            'token',
            'space_url'
        );
        $client->messages
            ->create(
                "+18888186061", // to
                array("+12504000000", "body" => "This is body message")
            );
}
SohrabZ commented 2 years ago

@ziagit here is a better version:

$params = [
    'from' => $from_phone_number,
    'body' => $message_body,
    'method' => 'POST',
    'statusCallback' => 'https://SOME_URL.com/status',
];

$response = $client->messages->create(
    $recipient_phone_number,
    $params
);
ziagit commented 2 years ago

Dear @SohrabZ how should I create $client object? please share the full code. really appreciated

when I try this code

public function send()
    {
        $params = [
            'from' => '+18888186061',
            'body' => 'Hi from signalwire',
            'method' => 'POST',
            'statusCallback' => 'https://tingsapp.com/home',
        ];
        $client = new \SignalWire\Rest\Client(
            '9e795027-...-...-....-5feee6200fe2',
            'PT03a8382.............706a351942f',
            ['space_url' => 'tingsapp.signalwire.com']
        );
        $response = $client->messages->create(
            '+12504000000',
            $params
        );
        return $response;
    }

I get the same error Class 'Twilio\Rest\Fax' not found

edolix commented 1 year ago

We released the v3.0.0 of the new https://packagist.org/packages/signalwire-community/signalwire#v3.0.0 package that includes this fix 👍