There are a lot of libraries out there for generating HTML forms using PHP. So far, however, I haven’t found one that meets both of these things:
- Simple, OOP usage.
- Flexible enough rendering that I can use it anywhere, but especially within a WordPress plugin.
A bonus option would be a library that can be included potentially multiple times (like CMB2) without conflicts.
I really like Symfony Forms, but it seems like there’s either a strong coupling to using the Twig templating engine, or a lot of work to roll your own engine.
I also like Carbon Fields, but the downside is that it currently isn’t usable on the frontend. It’s also very strongly coupled to WordPress objects.
CMB2 is a really great library, and one of the best choices in my opinion for anything related to meta boxes in WordPress. It can even do frontend display with some advanced usage (which I’ve written about before). But it’s also integrated tightly to WordPress, and is set up to be more procedural than I would like for the scenario I’m looking at.
If anyone has suggestions, feel free to let me know 🙂
Leave a Reply