I have an app which requires a user to register, everything was working fine, now I need to send registered user data to external API, so I installed guzzle http request as follows
composer require guzzlehttp/guzzle
And on the register controller, I added guzzle as follows
use GuzzleHttp\Client;
And in function create
protected function create(array $data)
{
    $user = User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        ]);
        $client = new client();
        $current_timestamp = Carbon::now()->timestamp;
        $request = $client->post('app3.salesmanago.pl/api/contact/upsert', [
            \GuzzleHttp\RequestOptions::HEADERS      => array(
                'debug'        => true,
                'Accept'       => 'application/json',
                'Content-Type' => 'application/json',
            ),
            \GuzzleHttp\RequestOptions::JSON => [
                'form_params' => [
                    'name'  => $data['name'],
                    'email' => $data['email'],
                    'clientId'     => 's255hncrw06k7ny45umc',
                    'apiKey'       => 'sj2q8rt5qp4fbp9qf2b8p49fz',
                    'sha'          => 'ba0br45543dcaf5ca82b09e33264fedb509cfb4806c',
                    'requestTime'  =>  $current_timestamp,
                    'owner'        => 'adwamtrw@fere.com',
                    'http_error'   => true
                ],
            ],
        ]);
}
On localhost tested everything works as expected now I updated my register controller, composer.json, composer-lock.json in production server and uploaded guzzle HTTP file to a vendor in production server
Now when I run the app I get the following error
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class 'GuzzleHttp\Client' not found
What do I need to do to solve this problem?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire