phore/status-page

Project description

v0.1.1 2018-11-28 17:14 UTC

This package is auto-updated.

Last update: 2020-03-26 10:49:58 UTC


README

Quick prototyping framework. Includes:

See our Interactive Demo!

Quick start

Your brand new status page can look like this within 30 seconds. StatusPage

Install library using composer:

composer require phore/status-page

Create your /www/index.php:

<?php
namespace App;
use Phore\StatusPage\PageHandler\NaviButtonWithIcon;
use Phore\StatusPage\StatusPageApp;

require __DIR__ . "/../vendor/autoload.php"; // Point to your composer vendor directory here!

$app = new StatusPageApp("MyApplication");

$app->addPage("/", function () {
    return ["h1" => "hello world"];
}, new NaviButtonWithIcon("Home", "fas fa-home"));

$app->serve();

Create a .htaccess file to define the fallback-resource: (If using kickstart, define apache_fallback_resource: "/index.php" in your .kick.yml)

FallbackResource /index.php

Done!

Authentication (HTTP Basic)

<?php 
$app = new BasicAuthStatusPageApp();
$app->allowUser("admin", "admin");

Features

Mouting the application in a subdirectory

Just create a subdirectory and a .htaccess file pointing to the subdirectories index file:

FallbackResource /subdir/index.php

Create the index.php and specifiy the subdirectories name as second constructor argument:

<?php

$app = new StatusPageApp("SomeName", "/subdir");
$app->addPage("/subdir/", function() {
    return ["h1"=>"SubApp"];
});
$app->serve();

Tables

<?php
$data = ["a", "b", "c"];

$tblData = phore_array_transform($data, function($key, $value) {
    return [
        date ("Y-m-d"),
        ["a @href=/some/other" => "Hello Column"]
    ];
});

$tbl = pt()->basic_table(
    ["Date",    "Comment"],
    $tblData,
    ["",        "@align=right"]
);