phink / phink
Think ${PHP} Different
0.9.7.52
2019-11-21 13:37 UTC
Requires
- php: >=7.0.0
- components/bootstrap: =3.3.5
- components/bootstrap-default: =3.3.5
- components/font-awesome: =4.7.0
- components/jquery: >=1.9.1
- components/jqueryui: >=1.12.1
- phink/phinkjs: ^0.3
- twig/twig: ^2.0
Requires (Dev)
- php-coveralls/php-coveralls: ^1.0
- phpunit/phpunit: 4.3.*
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-09-20 13:08:04 UTC
README
____ _ _ _
| _ \| |__ (_)_ __ | | __ ___ _ __ __ _
| |_) | '_ \| | '_ \| |/ / / _ \| '__/ _` |
| __/| | | | | | | | < | (_) | | | (_| |
|_| |_| |_|_|_| |_|_|\_(_)___/|_| \__, |
|___/
什么是 Phink?
Phink 框架是一个面向组件的 PHP 框架。它允许您使用类似于 ASP.Net webform 的用户控件和母版页来构建站点,同时受益于 MVC 架构。它集成一个客户端层,以 JavaScript API 的形式呈现,其外观非常类似于 PHP 类。这种耦合解决方案旨在轻松构建 Ajax 应用程序。一个简单的 JavaScript 启动语句即可启动整个应用程序。
要求
Apache(目前不支持其他服务器) PHP 7.4
PHP 扩展:SQLite、CURL、ZIP,其他一些默认应该已设置。
安装
Phink 已注册在 Packagist 库中,因此可以通过 composer 获取。
最简单的方法是将它作为独立应用程序安装,如下所示
composer create-project phink/phink myproject "dev-master"
用法
假设 myproject 是您本地 Apache 服务器 Document root 的子目录。
在您的浏览器中,转到:https:///myproject/src/web/setup/
所有必要的文件将自动设置,几秒钟后您将看到欢迎页面。
示例 JavaScript 启动脚本 sample.js
var sample = null;
Phink.DOM.ready(function () {
sample = TWebApplication.create('sample.com');
sample.main = sample.createView('main');
var sampleMain = sample.createController(sample.main, 'sample.main')
.actions({
goHome : function () {
sampleMain.getSimpleView('master.html', function(data) {
$(document.body).html(data.view);
sampleMain.getSimpleView('home.html', function(data) {
$('#homeContent').html(data.view);
});
});
}
})
.onload(function () {
sampleMain = this;
this.goHome();
});
});
示例 HTML 页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="css/_3rdparty.css" rel="stylesheet">
</head>
<body data-twttr-rendered="true" data-spy="scroll" >
<div id='body'></div>
<script type="text/javascript" src="phink.js"
data-depends="js/_3rd_party.js"
data-sources="js/sample.js">
</script>
</body>
</html>