cedriclombardot/twig-generator
TwigGenerator is a PHP code generator powered by Twig templates. Create builders and reusable template layouts to generate PHP classes and features cleanly and extensibly, using a Generator to render templates into output files.
Code Generation for Boilerplate Reduction:
Customizable Code Templates:
Build vs. Buy:
Roadmap for Developer Productivity:
git pre-commit hooks or GitHub Actions).Use Cases:
Look Elsewhere If:
make:model, make:controller, or Laravel Nova’s scaffolding).eval(), opcache, or bytecode compilers like RoadRunner.PhpCrush or Doctrine’s ORM metadata tools.Adopt If:
"This package lets us automate 80% of repetitive coding—like scaffolding Laravel models or API wrappers—using Twig templates, which our frontend team already knows. It’s like a ‘copy-paste on steroids’: developers define once in a template, and the system generates clean, consistent code every time. This cuts onboarding time by 30% and reduces bugs from manual boilerplate. We’re not replacing devs; we’re giving them superpowers to focus on business logic."
ROI:
"TwigGenerator lets us treat code as a template system. Need to generate a new Eloquent model with policies, migrations, and tests? Write a Twig template once, and it’s reusable across the codebase. It’s lightweight (MIT-licensed, no bloat), extensible (custom builders for complex logic), and debuggable (Twig errors are familiar).
Action Item: "Let’s prototype generating our User model + policy + test suite from a single template. If it saves us 2 hours next sprint, we’ll expand it to other domains."
How can I help you explore Laravel packages today?