Q:

How to include class in symfony 5?

I have a php file with Paysafecard class. File is called Paysafecard.php. I'd like to include it in my controller. How can I do it?

A:

If you are using Symfony surely you are using the composer autoload.
Go to the root directory path of your project and search the composer.json file.
Within it you find a directive like this : 
 "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },

This sentence indicates the mapping between the name and the directory.
Now look at the actual file path, for example /src/lib/Paymenterio.php
Go to the controller where you want to use the class replace the path with the autoload alias and remove the extension.
use App\lib\Paymenterio;

