Product Decisions This Supports
-
Build vs. Buy Decision:
- Adopt for form-heavy applications where security, validation, and maintainability are critical (e.g., user authentication, multi-step workflows, or data collection forms). The package’s built-in CSRF protection, server-side validation, and client-side rules reduce security risks and development overhead by ~50% compared to rolling out custom solutions.
- Justify over alternatives (e.g., Laravel Collective, Symfony Forms) when the team prioritizes tight frontend-backend integration (via
netteForms.js) or needs Latte templating support for PHP-based projects. Ideal for teams already using the Nette ecosystem or seeking minimal boilerplate for form logic.
- Avoid for projects requiring heavy UI customization (e.g., React/Vue frontends) or where Latte templating is incompatible. Not a fit for headless APIs or microservices lacking form-rendering needs.
-
Roadmap Prioritization:
- MVP Acceleration: Use pre-built validators (
addEmail(), addDateTime(), addEnum()) and client-side validation to ship forms 30–50% faster without sacrificing security.
- Compliance Features: Leverage CSRF protection, file upload validation, and data sanitization to meet GDPR/HIPAA requirements with minimal effort.
- Scalability: The container-based architecture simplifies adding dynamic forms (e.g., multi-step surveys, nested objects) without refactoring.
- Tech Debt Reduction: Replace spaghetti validation logic in legacy PHP apps with declarative rules (e.g.,
addRule($control, 'length:5..20')), cutting maintenance costs by ~40%.
-
Feature Expansion:
- Enhance user onboarding with client-side validation feedback (e.g., real-time error messages via
netteForms.js).
- Support complex workflows (e.g., conditional logic, dynamic fields) using
Container groups and toggleControl() for progressive disclosure.
- Integrate with existing stacks: Use
Blueprint to generate TypeScript models for frontend validation or DataClassGenerator to auto-map form data to PHP classes.
When to Consider This Package
-
Adopt if:
- Your app relies on forms as primary user interactions (e.g., SaaS dashboards, e-commerce, or admin panels).
- You need server-side validation + client-side feedback without writing custom JavaScript.
- Your team uses PHP/Latte or wants to avoid frontend frameworks for form rendering.
- Security/compliance is a priority (e.g., CSRF protection, file upload limits, data sanitization).
- You’re building a Nette-based app or want minimal integration friction with the ecosystem.
-
Look elsewhere if:
- Your frontend is React/Vue/Svelte and you need full control over form rendering (consider Formik, React Hook Form).
- You’re not using PHP or need multi-language support (e.g., Python/Django, Node.js).
- Your forms are extremely simple (e.g., a single login field) and custom solutions would be faster.
- You require advanced UI components (e.g., drag-and-drop, rich text editors) beyond basic inputs/selects.
- Your stack excludes JavaScript (client-side validation is optional but recommended).
How to Pitch It (Stakeholders)
For Executives:
"nette/forms lets us ship secure, validated forms 50% faster while reducing bugs and compliance risks. By leveraging its built-in CSRF protection, client-server validation sync, and Latte templating, we can cut development time for user onboarding, surveys, and admin tools—without sacrificing security. For example, a multi-step checkout form that would take 3 weeks to build from scratch could be implemented in 1 week with this package. The maintenance savings from declarative validation rules alone justify the adoption."
Key Outcomes:
✅ Faster time-to-market for form-heavy features.
✅ Reduced security risks (CSRF, XSS, and data validation handled out-of-the-box).
✅ Lower long-term costs (no custom validation logic to maintain).
✅ Seamless integration with PHP/Latte stacks (no frontend framework needed).
For Engineering Teams:
*"nette/forms is a batteries-included solution for PHP form handling that solves three major pain points:
- Validation: Write rules like
addRule($email, 'email') instead of manual regex checks. Supports client-side + server-side sync via netteForms.js.
- Security: CSRF protection, file upload limits, and data sanitization are built-in. No more forgetting to validate uploads or expose raw user input.
- Developer Experience: Fluent API for form building, Latte integration for templates, and TypeScript support for frontend validation.
Why not roll our own?
- 30% less code for common forms (e.g., login, contact forms).
- No more spaghetti validation logic—rules are declarative and reusable.
- Works with modern PHP (8.1+) and avoids legacy tech debt.
Trade-offs:
- Latte dependency: If you’re not using Latte, you’ll need to adapt the renderer.
- Client-side JS required: For best UX, use
netteForms.js (but server-side validation still works without it).
Recommendation: Pilot this for one high-impact form (e.g., user signup) to validate the time savings before rolling out broadly."*
Call to Action:
"Let’s prototype a user onboarding flow with nette/forms in the next sprint to compare dev time against our current approach. If it delivers 2x speed with zero security gaps, we’ll adopt it for all new form-heavy features."