phpolar/phpolar

A minimal PHP framework


README

PHPolar logo

Polar

A minimal PHP framework

Coverage Status Latest Stable Version Total Downloads License PHP Version Require Weekly Check

Quick Start
Documentation
API
Website

Quick start

# create an example application

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

Objectives

  1. Provide attributes so that objects can be declaratively configured for clean application development.
  2. Support using pure PHP templates with automatic XSS mitigation.
  3. Keep project small. See thresholds

Note For more details see the acceptance tests results

Pure PHP Templates

Example 1

<!DOCTYPE html>
<?php
(function (Page $view) {
?>
<html>
    // ...
    <body style="text-align:center">
        <h1><?= $view->title ?></h1>
        <div class="container">
        </div>
    </body>
</html>
<?php
})($this);

Use Attributes to Configure Models

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;
}

Thresholds

Module Source Code Size * Memory Usage Required
phpolar 12 kB 250 kB x
phplar/model 19 kB 108 kB
TOTAL 37 kB 358 kB
  • Note: Does not include comments.