Error trying to use ably Class "Ably\AblyRest" not found

226 Views Asked by At

Ok so i been following the tutorial for ably Building a realtime chat app with Laravel using WebSockets

but when i tried to create a messageEvent using the command: php artisan make:event PublicMessageEvent

this is what it shows: Class "Ably\AblyRest" not found

this is my composer.json required packeges package see if is anything wrong

  "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.10",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },

I tried composer-cache-clear deleting the vendor folder and composer install, but nothing the same error

The error appears even after clean composer install

now it even shows after installing all the packages so no idea what could it been.

1

There are 1 best solutions below

0
On BEST ANSWER

OK i solved the problem, this tow comments help me to figure it out:

In PHP you can only make use of classes if they exist. You can make use of Composer to require your dependencies, including the library you ask about. For more information visit the libraries installation instructions: github.com/ably/ably-php#installation – @hakre

The most important is to understand the tutorial. Some of the classes come from packages. The tutorial forgot to let you require the package: ably/laravel-broadcaster, now, if you understand what you need to do, keep going with your tutorial, otherwise learn about composer and then require the package and keep going. – @UnderDog

Also i want to thank @Ibrahim Hammed for answreing in teh tutorial there is a link to setup ably/laravel-broadcaster

and i didn't see the command composer require ably/laravel-broadcaster

so thanks you all so much.