Autoload files by patterns instead of listing each file Drupal's "autoloading" requires one to include the files in files[] declarations in the .info file. 

When there are a lot of files, this becomes:


A large, huge, list.
Hard to maintain.


Is there a way to e.g include with patterns. Say lib/*.php?
You can potentially use hook_registry_files_alter along with the PHP directory functions.  Something like

function foo_registry_files_alter (&amp;$files, $modules)
{
  $include_path = drupal_get_path('module', 'foo') . '/includes';

  if ($handle = opendir($include_path)) {
    while (($entry = readdir($handle)) !== FALSE) {
      if (preg_match('/\.php$/', $entry) === 1) {
        $files[$library_path . $entry] = array(
          'module' =&gt; 'foo',
          'weight' =&gt; 0,
        );
      }
    }
  }
}


This is untested, but the idea is to use scan an "include" directory for PHP files, and then tack them onto the array that the class registry uses for the autoloader.  This should work, but I can't remember exactly what readdir() returns, so you may need to adjust the paths a bit.