phpolar/phpolar

A minimal PHP framework


README

phpolar.svg

Polar

A minimal PHP framework

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

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
/**
 * @var Page $view
 */
$view = $this;
?>
<html>
    // ...
    <body style="text-align:center">
        <h1><?= $view->title ?></h1>
        <div class="container">
        </div>
    </body>
</html>

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 9 kB 200 kB x
phpolar/core 4 kB x
phplar/model 19 kB 108 kB
TOTAL 32 kB 308 kB
  • Note: Does not include comments.