Class 'Craft' not found
This is not really specific to Craft, but you should import Craft at the beginning of your class file like this:

&lt;?php

use Craft;

...


I suggest you take a look at that documentation for more details about how to import PHP classes: https://www.php.net/manual/en/language.namespaces.importing.php