This is my first module in CiviCRM and I have the example from the documentation but I can't get it to work. Every time I try to run in CiviCRM API Explorer v3 for attachments I get the following: Error: Class "CRM_Dkbrapi_APIWrapper_Attachment" not found in dkbrapi_civicrm_apiWrappers() (line 14 of [Drupal 9 Path]\sites\default\files\civicrm\ext\dkbrapi\dkbrapi.php).

-> dkbrapi.php


function dkbrapi_civicrm_apiWrappers(&$wrappers, $apiRequest) {
  if ($apiRequest['entity'] == 'Attachment' && $apiRequest['action'] == 'create') {
    if ($apiRequest['version'] == '3') {
      $wrappers[] = new CRM_Dkbrapi_APIWrapper_Attachment();

Class file Attachment.php in CRM/Dkbrapi/APIWrapper

class CRM_Dkbrapi_APIWrapper_Attachment implements API_Wrapper {
  public function fromApiInput($apiRequest) {
    // do some stuff

    return $apiRequest;
  public function toApiOutput($apiRequest, $result) {
     return $result;

What do i wrong?

1 Answer 1


Some things to check:

  • Check that your info.xml has lines like this:
      <psr0 prefix="CRM_" path="."/>
      <psr4 prefix="Civi\" path="Civi"/>
  • Clear civi cache: Administer - system settings - clear caches
  • Great, it seems to be working, thanks! I saw this part in the info.yml but didn't realize it needed another classloader.
    – ItsMe
    May 7, 2023 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.