Class 'Craft' not found I am new to PHP and trying to call reCaptcha API in CraftCMS. I have the following variable: 

$captcha = Craft::$app-&gt;getRequest()-&gt;getParam('g-recaptcha-response');


But I get the following error when I submit a form: 

Fatal error: Uncaught Error: Class 'Craft' not found


How can I import the Craft class?
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