Loading files or directories based on type
I don't see glaring performance issues that should make this "sluggish".

But you could improve performance by extracting specialized logic to specialized functions:


add_file
add_dir
add_array
add_json


Because,
in the current implementation,
for example,
when you scan a directory and call $this-&gt;add for each file,
the recursive call will do unnecessary is_string, is_dir, is_file checks on it.
Those checks don't need to be in the specialized add_file.

The same goes for the other input types,
when you separate to multiple functions,
there should be fewer unnecessary conditions to go through.

Users of the class,
when they know that the input is JSON data,
it will make sense that they should call add_json directly.
In the end,
I don't know what legitimate cases will be left for calling the generic add function.
At that point, you can delete the function.



The return statement is pointless here:

throw new \RuntimeException('Provided data could not be parsed ("' . substr($input, 0, 20) . '...").');
return;




Instead of this:


    case 'php':
      $content = require($input);
    break;



The common practice is to align the break statement with the content of the case, like this:

    case 'php':
      $content = require($input);
      break;




It's recommended to use braces { ... } with single-statement blocks too,
even they aren't strictly necessary.