stichoza / freshphp
此包已被废弃且不再维护。没有建议的替代包。
Fresh PHP MVC 框架
dev-master
2014-01-20 00:51 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2022-02-01 12:28:48 UTC
README
这是一个轻量级(或者可能过于复杂的)PHP 框架,它实现了 MVC 架构,并采用了其他一些 OOP 设计模式,如 Singleton 等。
目前我仅为了教学目的编写它,但我在一些项目中也在使用它。
为 FreshPHP 贡献
问题跟踪
在问题跟踪器中报告错误和问题(好主意也欢迎)
- 搜索现有问题以避免重复问题。
- 如有可能,包括一个实时示例。
- 尽可能分享更多信息。包括操作系统和版本。关于 PHP、MySQL、邮件服务器以及其他任何使用的软件的信息。
- 还包括重现错误的步骤。
拉取请求
所有拉取请求都欢迎!🤘
编码规范
灵感来源于Java 编码规范。
- 存储类的代码:
src/Namespace/.../Namespace/ClassName.php
- 花括号在同一行。**永不**使用新行来使用花括号。
- 缩进使用四个空格,永不使用制表符。
- 使用适当的缩进。
- 优先使用双引号。
- 逗号在最后,句点在最前面。
- 每行最多包含一个语句。
- 变量和函数/方法使用小写首字母的
camelCase
。 - 类名使用大写首字母的
CamelCase
。
// Correct if ($foo > 15) { $foo++; $bar--; print("ok"); $newArray = array( "key_1" => 452, "key_2" => array( "key_2_1" => "yolo" ), "key_3" => "hello", "key_4" => "world" ); echo "hello " . "world " . $foo . ":>"; }
if($foo>15) // Spaces around operators, spaces after keywords { // Don't use new lines for braces $foo++; $bar--; // Each line should contain at most one statement print('ok'); // Use double quotes $new_array = array( // Use camelCase in variable naming "key-1" => 452, // Never use dashes in array keys. Use underscores. "key_2" => array("key_2_1" => "yolo"), // Use proper indentation. "key_3" => "hello" , "key_4" => "world" // Comma-last ); echo "hello hello " . // Dot-first "world " . $foo.":>"; // Use spaces around dots. }