While I prefer PHP for the things Im also gonna add to my website. Next to that I found my approach and I query them within the server like @serjoscha87.
Didn’t think of that way myself…
But @serjoscha87 I’m working on my own CockpitClient that I will release but I took this approach.
$workEntries = $this->db->entries('work');
$workFields = $this->db->fields('work');
$workFieldss = $this->db->fields('work', true); // Not made yet but will process the fields
$this->db is because I use Slim Framework and I resolve the db service
My Function but I share the rest later. Im fixing the major calls and Ill release the first version on Packagist.
/**
* @param $collection
* @return false|string
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Exception
*/
public function fields($collection, $process = false)
{
if($process === true) {
throw new \Exception('Not implemented');
}
$this->_request = new CockpitRequest('GET', Endpoint::getCollection);
$this->_request->setQuery('fields');
$this->_request->addParam('name', $collection);
return $this->getJson();
}