I'm trying to use Podios PHP client library to create a new item in a Podio app.
I use the code from their example page but at the moment I try to:
// Create a field collection with some fields.
// Be sure to use the external_ids of your specific fields
$fields = new PodioItemFieldCollection(array(
new PodioTextItemField(array("external_id" => "my-text-field", "values" => "FooBar")),
new PodioProgressItemField(array("external_id" => "my-number-field", "values" => 75))
));
// Create the item object with fields
// Be sure to add an app or podio-php won't know where to create the item
$item = new PodioItem(array(
'app' => new PodioApp(123), // Attach to app with app_id=123
'fields' => $fields
));
// Save the new item
$item->save();
I get the following error:
PHP Fatal error: Cannot declare class PodioItemField, because the name is already in use in /var/www/html/podioproject/vendor/podio/podio-php/models/PodioItemField.php on line 0
I don't really understand what the error means so its hard for me to figure out what is loaded wrong and why.
There are other questions on stackoverflow where people answered to change include
to include_once
. I'm using composer's autoloader though, so that solution doesn't apply
composer.json:
{
"require": {
"podio/podio-php": "^4.3",
"slim/slim": "^3.10"
}
}