first commit
This commit is contained in:
parent
c112a89d85
commit
65c2bb289b
21
README.md
21
README.md
@ -1,3 +1,20 @@
|
||||
# novaconium
|
||||
![Novaconium PHP](/_assets/header.svg)
|
||||
|
||||
4LT's PHP framework
|
||||
# Novaconium PHP: A PHP Framework Built from the Past
|
||||
|
||||
NovaconiumPHP is a high-performance PHP framework designed with inspiration from classic coding principles.
|
||||
|
||||
Pronounced: Noh-vah-koh-nee-um
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
mkdir project_name;
|
||||
cd project_name;
|
||||
mkdir -p App/controllers App/templates App/views public
|
||||
touch App/controllers/404.php App/controllers/index.php App/views/index.html.twig public/index.php public/.htaccess App/routes.php
|
||||
|
||||
composer require 4lt/novaconium
|
||||
```
|
||||
|
39
_assets/header.svg
Normal file
39
_assets/header.svg
Normal file
@ -0,0 +1,39 @@
|
||||
<svg width="100%" height="200" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="100%" height="100%" fill="black"/>
|
||||
<defs>
|
||||
<radialGradient id="star-gradient" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
|
||||
<stop offset="0%" style="stop-color: white; stop-opacity: 1" />
|
||||
<stop offset="100%" style="stop-color: white; stop-opacity: 0" />
|
||||
</radialGradient>
|
||||
<g id="star">
|
||||
<circle cx="0" cy="0" r="2" fill="white" />
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<!-- Lots of stars moving outward slower -->
|
||||
<g>
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-300,-150) scale(1)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(300,-150) scale(1)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-300,150) scale(1)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(300,150) scale(1)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-150,-75) scale(0.5)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(150,-75) scale(0.5)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-150,75) scale(0.5)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(150,75) scale(0.5)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-75,-37) scale(0.7)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(75,-37) scale(0.7)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-75,37) scale(0.7)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(75,37) scale(0.7)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-350,-175) scale(0.4)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(350,-175) scale(0.4)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(-350,175) scale(0.4)" />
|
||||
<use href="#star" x="50%" y="50%" transform="translate(350,175) scale(0.4)" />
|
||||
<animateTransform attributeName="transform" type="scale" from="1" to="10" dur="2s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity" from="1" to="0" dur="2s" repeatCount="indefinite" />
|
||||
</g>
|
||||
|
||||
<!-- Centered Title -->
|
||||
<text x="50%" y="50%" fill="white" font-size="40" text-anchor="middle" font-family="Arial" dy=".3em">
|
||||
Novaconium PHP
|
||||
</text>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
29
composer.json
Normal file
29
composer.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "4lt/novaconium",
|
||||
"description": "A high-performance PHP framework built from the past.",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nick Yeoman",
|
||||
"email": "dev@4lt.ca",
|
||||
"homepage": "https://www.4lt.ca",
|
||||
"role": "Consultant"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Novaconium\\\\": "src/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"twig/twig": "*",
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"extra": {
|
||||
"versioning": {
|
||||
"strategy": "semantic-versioning"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
43
src/Router.php
Normal file
43
src/Router.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
class Router {
|
||||
public $routes = [];
|
||||
public $query = [];
|
||||
public $path;
|
||||
public $controllerPath = BASEPATH . '/App/controllers/404.php';
|
||||
|
||||
public function __construct() {
|
||||
$this->loadRoutes();
|
||||
$this->preparePath();
|
||||
$this->prepareQuery();
|
||||
$this->setRouteFile();
|
||||
}
|
||||
|
||||
private function loadRoutes() {
|
||||
require_once( BASEPATH . '/App/routes.php');
|
||||
$this->routes = $routes;
|
||||
}
|
||||
|
||||
private function preparePath() {
|
||||
$this->path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
}
|
||||
|
||||
private function prepareQuery() {
|
||||
$parsedUri = parse_url($_SERVER['REQUEST_URI']);
|
||||
$queryArray = [];
|
||||
if (isset($parsedUri['query'])) {
|
||||
parse_str($parsedUri['query'], $queryArray);
|
||||
}
|
||||
$this->query = $queryArray;
|
||||
}
|
||||
|
||||
private function setRouteFile() {
|
||||
foreach ($this->routes as $key => $value) {
|
||||
if ( $this->path == $key) {
|
||||
$this->controllerPath = BASEPATH . '/App/controllers/' . $value['file'] . '.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
13
src/bootstrap.php
Normal file
13
src/bootstrap.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
require_once(BASEPATH . '/vendor/autoload.php');
|
||||
|
||||
//Twig
|
||||
$loader = new Twig\Loader\FilesystemLoader(BASEPATH . '/App/views/');
|
||||
$loader->addPath(BASEPATH . '/vendor/nickyeoman/nytwig/src', 'nytwig');
|
||||
$loader->addPath(BASEPATH . '/App/templates', 'override');
|
||||
$twig = new Twig\Environment($loader);
|
||||
|
||||
// Load a controller
|
||||
require_once('Router.php');
|
||||
$router = new Router();
|
||||
require_once($router->controllerPath);
|
Loading…
Reference in New Issue
Block a user