概述 快速入门 教程 手册 最佳实践 组件 参考 贡献

发布于 2015-08-27 16:24:44 | 203 次阅读 | 评论: 0 | 来源: 网络整理

Configuration usually involves different application parts (such as infrastructure and security credentials) and different environments (development, production). That’s why Symfony recommends that you split the application configuration into three parts.

别为难自己:不必按场景配置

最佳实践

Don’t define a semantic dependency injection configuration for your bundles.

As explained in 如何在Bundle内部载入Service配置 article, Symfony bundles have two choices on how to handle configuration: normal service configuration through the services.yml file and semantic configuration through a special *Extension class.

Although semantic configuration is much more powerful and provides nice features such as configuration validation, the amount of work needed to define that configuration isn’t worth it for bundles that aren’t meant to be shared as third-party bundles.

避免在Symfony项目里泄露敏感配置

When dealing with sensitive options, like database credentials, we also recommend that you store them outside the Symfony project and make them available through environment variables. Learn how to do it in the following article: 如何将Service Container的参数暴露到外部

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务