joearchika/hyper-php

Hyper,PHP的快速MVC框架

v1.0-alpha 2021-05-04 05:25 UTC

This package is auto-updated.

Last update: 2024-09-09 20:48:10 UTC


README

--

入门

待办事项

  • 安全 web.json

创建新的Hyper应用程序:index.php

导入 HyperApp
use Hyper\Application\HyperApp;
通过 require 导入hyper文件以启用大部分功能
require 'hyper/index.php';
创建并运行应用程序
new HyperApp("<Name of your app>", "auto");
使用自定义部分运行应用程序
$customSections = ["hello-section"];
new HyperApp("<Name of your app>", "auto", $customSections);
使用手动路由运行应用程序
//TODO: work on manual routing
完整的index.php
use Hyper\Application\HyperApp;

require 'Hyper/Index.php';

new HyperApp("<Name of your app>", "auto");
用法
//Put section where you want it to be rendered. Usually layout.php
<h-section type="hello-section"></h-section>

//Put section content from other views
<h-section hello-section></h-section>
配置

Hyper配置存储在web.json或您自己的JSON文件中

数据库连接

要配置数据库,在配置文件web.json中添加一个db对象

例如

{
  "db": {
    "host": "localhost",
    "port": 80,
    "database": "<dbName>",
    "username": "root",
    "password": ""
  }
}
调试

要打开/关闭调试模式,将debug属性设置为json,例如

{
  "debug": true
}
自定义错误页面