<?php /** * @file * Custom module. */ declare(strict_types=1); use Symfony\Component\Finder\Finder; $finder = Finder::create() ->in(__DIR__ . DIRECTORY_SEPARATOR . 'hooks') ->name('/.[php|inc]$/'); foreach ($finder as $file) { include $file->getPathname(); }