php 为什么在 Laravel 5.x 中不推荐使用 Form 和 HTML 助手?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35695949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why are Form and HTML helpers deprecated in Laravel 5.x?
提问by Dees Oomens
Why are the Form and HTML helpers deprecated since Laravel 5? I know I could use something like laravelcollective/html
packages. But I was just wondering why Laravel stopped using/devolving the helpers.
为什么自 Laravel 5 起不推荐使用 Form 和 HTML 助手?我知道我可以使用类似laravelcollective/html
包的东西。但我只是想知道为什么 Laravel 停止使用/下放助手。
回答by Emeka Mbah
The answer is simple.
答案很简单。
Taylor Otwell decided to remove Form and Html from core components because it's something that should be maintained by the community through packages like https://github.com/LaravelCollective/html. Few other components were removed to keep the framework slim. Not everyone uses Form and HTML , I personally prefer pure HTML.
Taylor Otwell 决定从核心组件中删除 Form 和 Html,因为它应该由社区通过https://github.com/LaravelCollective/html 之类的包来维护。很少有其他组件被移除以保持框架的纤薄。不是每个人都使用 Form 和 HTML ,我个人更喜欢纯 HTML。
My Opinion
我的看法
One of my opinions on this is the issue of performance, If you check Form and HTML classes you will see how forms are actually generated, which involves looping with foreach
and other script just to generate simple form which simply doesn't happen when you use your plain HTML in your blade.
我对此的看法之一是性能问题,如果您检查 Form 和 HTML 类,您将看到表单是如何实际生成的,这涉及循环使用foreach
和其他脚本只是为了生成简单的表单,当您使用时根本不会发生这种情况刀片中的纯 HTML。
Laravel Form & HTML components also have limitations in terms of full customization but when you use plain HTML in your blade you can freely customize the form in anyway you like and any front-end developer can understand it without learning Laravel or Blade.
Laravel Form 和 HTML 组件在完全自定义方面也有局限性,但是当您在 Blade 中使用纯 HTML 时,您可以随意自定义表单,任何前端开发人员都可以在不学习 Laravel 或 Blade 的情况下理解它。
I actually think Laravel Form & HTML are for lazy developers, my opinion :)
我实际上认为 Laravel Form 和 HTML 适合懒惰的开发人员,我认为 :)
You can do without Form & Html builders completely or you can use available packages
您可以完全不用 Form & Html 构建器,也可以使用可用的包
回答by Alexey Mezenin
They say Laravel developers removed it because they want to keep framework simple. Not all devs use all components, so they can just add modules manually.
他们说 Laravel 开发人员删除它是因为他们想让框架保持简单。并非所有开发人员都使用所有组件,因此他们可以手动添加模块。
A lot of developers were shocked by this decision, because Laravel Collective is really useful and great part of Laravel. I really hope Laravel Collective will be core part of Laravel framework again.
许多开发人员对这个决定感到震惊,因为 Laravel Collective 非常有用,并且是 Laravel 的重要组成部分。我真的希望 Laravel Collective 再次成为 Laravel 框架的核心部分。