Search code examples
phplaravelsalesforcesoql

laravel salesforce require_once?


I got a problem.I made a new class for my controller, in this class I do that to connect to salesforce

require_once ('salesforce/soapclient/SforceEnterpriseClient.php');

but I still have a problem.

(1/1) FatalErrorException Class 'App\Services\SforceEnterpriseClient' not found


Solution

  • Laravel is not meant to use require_once, which is a standard PHP expression. Use a Composer package such as this: https://packagist.org/packages/phpforce/soap-client

    If you do need to require a specific file, add it into your app directory, maybe under a new Integrations folder and give it a believe namespace of App\Integrations. Then, in your controller, use App\Integrations\SforceEnterpriseClient;