从Magento 2.2开始,所描述的半文档库方法不再起作用。Magento鼓励开发人员根据以下条件使用composer添加库:
https://github.com/magento/magento2/issues/10985 
可行的方法是添加您自己的自动装带器:
lib/internal/Your/Library/registration.php
<?php
namespace Your\Library;
spl_autoload_register(function ($class) {
  $prefix   = __NAMESPACE__ . '\\';
  $base_dir = __DIR__.'/';
  $len = strlen($prefix);
  if (strncmp($prefix, $class, $len) !== 0) {
    return;
  }
  $relative_class = substr($class, $len);
  $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
  if (file_exists($file)) {
    require $file;
  }
});
由于app/etc/NonComposerComponentRegistration.php仍然包含以下目录,因此该方法有效:
$pathList[] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/registration.php';
$pathList[] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/*/registration.php';