phpolar/phpolar

一个极简的PHP框架

5.0.0 2023-09-04 14:53 UTC

This package is auto-updated.

Last update: 2024-08-27 04:06:47 UTC


README

Polar

一个极简的PHP框架

Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

快速开始
文档
API
网站

快速开始

# create an example application

composer create-project phpolar/skeleton <target-directory>

目标

  1. 提供 属性,以便对象可以声明性配置以实现干净的应用程序开发。
  2. 支持使用 纯PHP模板 并自动减轻XSS攻击。
  3. 保持项目小型。见 阈值

注意 更多详情请参阅 验收测试结果

纯PHP模板

示例 1

<!DOCTYPE html>
<?php
/**
 * @var Page $view
 */
$view = $this;
?>
<html>
    // ...
    <body style="text-align:center">
        <h1><?= $view->title ?></h1>
        <div class="container">
        </div>
    </body>
</html>

使用属性配置模型

use Phpolar\Phpolar\AbstractModel;

class Person extends AbstractModel
{
    #[MaxLength(20)]
    public string $firstName;

    #[MaxLength(20)]
    public string $lastName;

    #[Column("Residential Address")]
    #[Label("Residential Address")]
    #[MaxLength(200)]
    public string $address1;

    #[Column("Business Address")]
    #[Label("Business Address")]
    #[MaxLength(200)]
    public string $address2;
}

阈值

  • 注意:不包括注释。