joecharika/hyper-php

Hyper, fast MVC framework for PHP

v1.0-alpha 2021-05-04 05:25 UTC

This package is auto-updated.

Last update: 2024-06-10 09:16:52 UTC


README

--

Getting started

TODOs

  • Secure web.json

Create new Hyper app: index.php

Import HyperApp class:
use Hyper\Application\HyperApp;
Import hyper file to enable most functions using require
require 'hyper/index.php';
Create and run the application
new HyperApp("<Name of your app>", "auto");
Run app with custom sections
$customSections = ["hello-section"];
new HyperApp("<Name of your app>", "auto", $customSections);
Run app with manual routing
//TODO: work on manual routing
Complete index.php
use Hyper\Application\HyperApp;

require 'Hyper/Index.php';

new HyperApp("<Name of your app>", "auto");
Usage:
//Put section where you want it to be rendered. Usually layout.php
<h-section type="hello-section"></h-section>

//Put section content from other views
<h-section hello-section></h-section>
Config

Hyper configurations are stored in web.json or your own JSON file

Database connection

To configure a database, add a db object in the config file web.json

For example:

{
  "db": {
    "host": "localhost",
    "port": 80,
    "database": "<dbName>",
    "username": "root",
    "password": ""
  }
}
Debug

To turn on/off debug mode set debug property to json For example:

{
  "debug": true
}
Custom error pages