Download the PHP package ruudk/code-generator without Composer
On this page you can find all versions of the php package ruudk/code-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ruudk/code-generator
More information about ruudk/code-generator
Files in ruudk/code-generator
Package code-generator
Short Description Yield your code line by line: let generators handle indentation, formatting, and structure for you
License MIT
Informations about the package code-generator
Code Generator for PHP
Yield your code line by line: let generators handle indentation, formatting, and structure for you
Code Generator
Transform the way you generate PHP code! This library makes code generation feel natural and elegant - just yield your lines and watch as perfectly formatted, beautifully structured PHP emerges with automatic namespace imports, proper indentation, and clean syntax.
✨ Why This Library?
Ever struggled with generating PHP code? String concatenation getting messy? Indentation driving you crazy? This is your solution!
🎯 Write code that writes code - but make it beautiful
🎯 Yield line by line - no string concatenation nightmares
🎯 Automatic everything - imports, indentation, formatting handled for you
🎯 Composable generators - chain, wrap, and transform with ease
🎯 Zero boilerplate - focus on what to generate, not how
🚀 Key Features
🎨 Beautiful Output, Every Time
- Smart namespace management - imports are automatically collected and organized
- Perfect indentation - just yield your lines, nesting is handled automatically
- Clean formatting - proper spacing, consistent style, readable code
🔧 Powerful Generator Toolkit
indent()- Auto-indent nested code blocksjoin(),wrap(),prefix(),suffix()- Transform and compose generatorscomment(),blockComment(),docComment()- Generate any comment styledumpCall(),dumpAttribute()- Smart method calls and attributesstatement()- Auto-add semicolons where needed
🎭 Flexibility First
- Yield strings, arrays, or generators - mix and match as needed
- Compose generators - results can be wrapped, joined, and transformed
- Conditional generation -
maybeWrap()for optional structures - Multi-line strings - automatic HEREDOC/NOWDOC handling
📦 Get Started in Seconds!
Install via Composer and start generating beautiful code immediately:
That's it! You're ready to transform your PHP code generation. 🚀
💡 The Magic: Before & After
❌ Before (The Old Way)
✅ After (The Generator Way)
See the example below - clean, maintainable, and beautiful! The generator handles all the complexity for you.
Output
Another Example
Output
💖 Support This Project
Love this tool? Help me keep building awesome open source software!
Your sponsorship helps me dedicate more time to maintaining and improving this project. Every contribution, no matter the size, makes a difference!
🤝 Contributing
I welcome contributions! Whether it's a bug fix, new feature, or documentation improvement, I'd love to see your PRs.
📄 License
MIT License – Free to use in your projects! If you're using this and finding value, please consider sponsoring to support continued development.