PHP, Codeigniter, Fractal API output

Job ID: 31189822

Budget: $2 – $8 USD

I need help with getting the right output from code.

I want to be able to put key-values before "Resources" in the output. Key-values like "schemas" and "totalResults"

This is my code:
public function index()
{

$UserModel = new UserModel();
$Users = $UserModel->findAll();

try {
$fractal = new Manager();

$fractal->setSerializer(new DataSerializer());
$UsersItem = new Collection($Users, new UserTransformer(), 'Resources');
$json = $fractal->createData($UsersItem)->toJson();


} catch (Throwable $t) {
return $this->response
->setStatusCode(500)
->setBody(Error::internalError());
}

return $this->response->setStatusCode(200)
->setHeader("Content-Type", "application/scim+json")
->setHeader("Location", "mysite")
->setBody($json);
}

Output is in the image file
Related categories: PHP Codeigniter