Labor API: am I using wrong model?

Using the PHP SDK, in /docs/ it calls for:
$body = new Models\SearchShiftsRequest;

Unfortunately, I get:
( ! ) Fatal error: Uncaught Error: Class ‘Models\SearchShiftsRequest’ not found in C:\wamp64\www\square\listShifts.php on line 56

Am I using the wrong model reference?

FYI I am using:
require ‘vendor/autoload.php’;

use Square\SquareClient;
use Square\Environment;
use Square\Exceptions\ApiException;
use Square\Http\ApiResponse;

I’ve been able to list payments successfully, but I didn’t have to create $body for that query, so this is unfamiliar.

Also, since I’m new to this, is there a sample to follow for PHP? (I’m only listing from the object, not creating or updating records.)


Hi, Are you also including the Labor API class use Square\LaborApi; when making the call?

Thanks, I added the “use” statement, but still have the same error. I notice in LaborApi.php that "use Unirest\Request;” is marked “cannot be resolved”. It seems that the \src\Unirest folder is missing! Probably I should use composer to reinstall the SDK and see if that fixes the problem.

Okay great. Let us know if you have any additional questions.

I reinstalled the SDK using composer, then I fixed the problem by adding “use Square\Models;”


That’s awesome! :tada: Please feel free to reach out if you have any additional questions.