<?php declare(strict_types=1); $template = <<<'EOT' <?php declare(strict_types=1); namespace Lubian\AttributeMagic\Handler\Viel; use Lubian\AttributeMagic\Infrastructure\Route\AsHandler; use Lubian\AttributeMagic\Infrastructure\Route\HttpMethod; final class Template { #[AsHandler(HttpMethod::GET, '/Viel/template0')] public function template0(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template1')] public function template2(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template2')] public function template3(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template3')] public function template4(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template4')] public function template5(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template5')] public function template6(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template7')] public function template7(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template8')] public function template8(): void {} #[AsHandler(HttpMethod::GET, '/Viel/template9')] public function template9(): void {} } EOT; function randomString(int $length = 20) { $str = ''; $chars = 'abzdefghijklmnopqrstuvwxyz'; $chars = $chars . strtoupper($chars); $chars = str_split($chars, 1); $upper = count($chars) -1; for ($i = 0; $i < $length; $i++) { $int = random_int(0, $upper); $str = $str . $chars[$int]; } return $str; } for($c = 0; $c < 1000; $c++) { $name = randomString(); $content = str_replace(['Template', 'template'], [$name, $name], $template); file_put_contents(__DIR__ . '/src/Handler/Viel/' . $name . '.php', $content); }