@@ -140,11 +140,6 @@ public function __invoke(
140140 $ this ->io ->success ("Generated component class: {$ componentFile }" );
141141 }
142142 }
143-
144- // Generate bundle files for twig-component
145- if ($ name === 'twig-component ' ) {
146- $ this ->generateBundleFiles ($ dest . \DIRECTORY_SEPARATOR . $ name , $ overwriteExisting );
147- }
148143 }
149144 return Command::SUCCESS ;
150145 }
@@ -176,151 +171,6 @@ private function loadHtmlDefinitions(?string $specificationPath): bool
176171 return true ;
177172 }
178173
179- private function generateBundleFiles (string $ bundleDir , bool $ overwrite ): void
180- {
181- // Generate composer.json
182- $ composerJson = [
183- 'name ' => 'vardumper/html5-ux-twig-component-bundle ' ,
184- 'description ' => 'Symfony UX Twig Components for typesafe HTML5 elements with ARIA support & enum validation ' ,
185- 'type ' => 'symfony-bundle ' ,
186- 'license ' => 'MIT ' ,
187- 'keywords ' => ['symfony ' , 'twig ' , 'components ' , 'html5 ' , 'aria ' , 'ux ' ],
188- 'authors ' => [
189- [
190- 'name ' => 'vardumper ' ,
191- 'email ' => 'info@erikpoehler.com ' ,
192- ],
193- ],
194- 'require ' => [
195- 'php ' => '^8.2 ' ,
196- 'symfony/twig-bundle ' => '^6.0|^7.0 ' ,
197- 'symfony/ux-twig-component ' => '^2.0 ' ,
198- 'vardumper/extended-htmldocument ' => '^0.2 ' ,
199- ],
200- 'autoload ' => [
201- 'psr-4 ' => [
202- 'Html \\TwigComponentBundle \\' => 'src/ ' ,
203- ],
204- ],
205- 'extra ' => [
206- 'symfony ' => [
207- 'require ' => '^6.0|^7.0 ' ,
208- ],
209- ],
210- ];
211-
212- $ composerFile = $ bundleDir . \DIRECTORY_SEPARATOR . 'composer.json ' ;
213- if (! file_exists ($ composerFile ) || $ overwrite ) {
214- file_put_contents (
215- $ composerFile ,
216- json_encode ($ composerJson , \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES ) . "\n"
217- );
218- $ this ->io ->success ("Generated: {$ composerFile }" );
219- }
220-
221- // Generate HtmlComponentBundle.php
222- $ bundleClass = <<<'PHP'
223- <?php
224-
225- namespace Html\ComponentBundle;
226-
227- use Symfony\Component\HttpKernel\Bundle\Bundle;
228-
229- /**
230- * HTML Component Bundle
231- *
232- * Provides Symfony UX Twig Components for all HTML5 elements with ARIA support.
233- *
234- * @author vardumper <info@erikpoehler.com>
235- * @package Html\ComponentBundle
236- */
237- class HtmlComponentBundle extends Bundle
238- {
239- public function getPath(): string
240- {
241- return \dirname(__DIR__);
242- }
243- }
244-
245- PHP;
246-
247- $ bundleFile = $ bundleDir . \DIRECTORY_SEPARATOR . 'src ' . \DIRECTORY_SEPARATOR . 'HtmlComponentBundle.php ' ;
248- if (! file_exists ($ bundleFile ) || $ overwrite ) {
249- $ bundleFileDir = dirname ($ bundleFile );
250- if (! is_dir ($ bundleFileDir )) {
251- mkdir ($ bundleFileDir , 0755 , true );
252- }
253- file_put_contents ($ bundleFile , $ bundleClass );
254- $ this ->io ->success ("Generated: {$ bundleFile }" );
255- }
256-
257- // Generate README.md
258- $ readme = <<<'MD'
259- # HTML Component Bundle
260-
261- Symfony UX Twig Components for all HTML5 elements with ARIA support.
262-
263- ## Installation
264-
265- ```bash
266- composer require html/component-bundle
267- ```
268-
269- ## Configuration
270-
271- Register the bundle in `config/bundles.php`:
272-
273- ```php
274- return [
275- // ...
276- Html\ComponentBundle\HtmlComponentBundle::class => ['all' => true],
277- ];
278- ```
279-
280- ## Usage
281-
282- Use any HTML element as a Twig Component:
283-
284- ```twig
285- <twig:Blockquote cite="https://example.com">
286- This is a quote from example.com
287- </twig:Blockquote>
288-
289- <twig:Button role="button" type="submit">
290- Submit Form
291- </twig:Button>
292-
293- <twig:Input type="email" name="email" required />
294- ```
295-
296- ## Features
297-
298- - ✅ All HTML5 elements supported
299- - ✅ Full ARIA attributes support
300- - ✅ Type-safe enum validation
301- - ✅ PreMount validation with OptionsResolver
302- - ✅ Proper namespace structure (Block/Inline/Void)
303-
304- ## Components Structure
305-
306- Components are organized by type:
307- - `Block` - Block-level elements (div, section, article, etc.)
308- - `Inline` - Inline elements (span, a, strong, etc.)
309- - `Void` - Self-closing elements (img, input, br, etc.)
310-
311- ## License
312-
313- MIT
314-
315- MD;
316-
317- $ readmeFile = $ bundleDir . \DIRECTORY_SEPARATOR . 'README.md ' ;
318- if (! file_exists ($ readmeFile ) || $ overwrite ) {
319- file_put_contents ($ readmeFile , $ readme );
320- $ this ->io ->success ("Generated: {$ readmeFile }" );
321- }
322- }
323-
324174 /**
325175 * Get safe component class name, avoiding PHP reserved words
326176 */
0 commit comments