uwdoem/framework

此包已废弃,不再维护。作者建议使用athens/core包。

适用于学术环境的现代PHP网络框架

0.35.3 2017-12-27 18:38 UTC

README

Build Status Code Climate Test Coverage Latest Stable Version

Athens/Core

Athens是一个由华盛顿大学招生管理部构建的现代PHP网络框架。


![Athens in action](doc/assets/images/demo.png) *在Athens创建的Web应用程序中轻松创建表单并管理提交结果*

Athens中构建的应用程序

  1. 安全
*Athens* automatically provides strong protection against a number of web attacks, including CSRF, XSS, and database injection.  

*Athens* also provides easy, seamless encryption for sensitive student information. Encrypting a database column requires a simple declaration in your model schema for each data-field you want to protect. Calls to and from the database on that encrypted data are transparent; *Athens* knows which fields are encrypted and handles the encryption/decryption behind the scenes.
  1. 吸引人
*Athens* includes beautiful page templates and user-interface elements. These default templates can be easily overridden with custom themes to implement your own organization's brand.
  1. 易于阅读

    Athens将声明页面应包含哪些元素这些元素应如何显示以及这些元素应如何行为的逻辑分离开来。在这种模式下,创建页面并不比简单地列出应存在的表示元素复杂。

  2. 可扩展性

This separation of concerns also promotes reusability of components: a web-displayed table can be turned into Excel by changing a single line of code; a web-displayed form can be presented as a PDF by changing a single line of code. Adding a column to a table takes only one line, and in most cases *Athens* will be able to populate that column from the database without any further instruction.

启动应用程序

有关安装Athens并开始新应用程序的帮助,请参阅应用程序创建教程

安装

此库已发布在Packagist上。要使用Composer安装,请在您的"require"依赖关系中添加"athens/core": "0.*"行。

{
    "require": {
        ...
        "athens/core": "0.*",
        ...
    }
}

由于Athens依赖于多个其他库,强烈建议您使用Composer来安装此库并管理依赖项。

示例

Athens使用由PropelORM生成的类来存储和检索数据库行。首先,我们在schema.xml中定义一个学生类

<table name="student">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>

    <column name="uw_student_number" type="varchar" size="7" required="true" phpName="UWStudentNumber"/>
    <column name="first_name" type="varchar" size="127" required="true"/>
    <column name="middle_initial" type="varchar" size="15" required="true"/>
    <column name="last_name" type="varchar" size="127" required="true"/>
    <column name="last_four_ssn" type="varchar" size="4" required="true"/>
</table>

现在我们可以使用Propel生成一个Student实例并创建一个表单,该表单将学生存储在数据库中

<?php

require_once dirname(__FILE__) ."/../setup.php";

use Athens\Core\Form\FormBuilder;
use Athens\Core\Page\PageBuilder;
use Athens\Core\Page\Page;

use MyProject\Student;

$form = FormBuilder::begin()
    ->setId("student-form")
    ->addObject(new Student())
    ->build();

$page = PageBuilder::begin()
    ->setId('student-submission-page')
    ->setType(Page::PAGE_TYPE_FULL_HEADER)
    ->setTitle("My Project: Enter a Student")
    ->setHeader("My Project")
    ->setSubHeader("Enter a Student")
    ->setBaseHref("..")
    ->setWritable($form)
    ->build();

$page->render();

附加功能

以下库提供了额外的功能

  1. 加密

无缝加密敏感数据字段。加密包包含在您的Athens项目中,以确保数据库中任何表列在休息时都加密。

Athens项目默认包含Encryption包;您只需要在schema.xml中添加几行额外的代码即可将加密添加到您的模型中。请参阅[加密项目文档(/AthensFramework/Encryption/)或应用程序创建教程

  1. SendGrid

通过您的SendGrid账户发送电子邮件。通过在设置中添加几行额外的代码,您的Athens应用程序将通过SendGrid发送所有电子邮件。

SendGrid包不是自动包含在您的Athens项目中的;您必须按照项目说明使用此包。

  1. CSRF

标准的Athens模板项目通过CSRF包提供对CSRF攻击的保护。您可以通过访问项目文档了解更多信息。

兼容性

  • PHP 5.6, 7.0

待办事项

请参阅GitHub 问题跟踪器

参与进来

请随意提交拉取请求或问题。此项目的规范位置是 GitHub

以下是代码贡献的一般事件顺序

  1. 问题跟踪器 中开启一个问题。
  2. 不分先后顺序
  • 提交一个带有 失败的 测试的拉取请求,以演示问题/功能。
  • 获取确认/同意。
  1. 修订您的拉取请求以通过(2)中的测试。如果适当,包括文档。

PSR-2 合规性由 Travis 中的 CodeSniffer 强制执行。