2017 © Pedro Peláez
 

library nemesis-framework

Small PHP5 Framework

image

kimihub/nemesis-framework

Small PHP5 Framework

  • Friday, April 10, 2015
  • by kimihub
  • Repository
  • 1 Watchers
  • 0 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Nemesis Framework

Nemesis is a small PHP Framework that I've started to sustain when I realized I needed a lightweight, native, minimalistic and flexible tool to quickly develop MVC web app or REST api for testing and specific requests which require to work on a basic shared web hosting with few hardware resources., (*1)

Features

The architecture is built on well known patterns (Model Controller or Model View Controller) with a basic bootstraper / class autoloader and some procedural functions, so, what PHP can do properly without any extra-dependencies., (*2)

Core components

The core is customizable according to the components needed and their dependencies, (*3)

Classes

Loader : autoloader, (*4)

Hook : trigger a hook, depends to Loader, (*5)

Session : manage a secure session, depends to Loader, (*6)

Plugin : DEPRECATED, (*7)

URL : get headers received, hash and output URLs, depends to Loader, (*8)

Router : create routes, depends to Loader, URL, (*9)

Api : manage a simple JSON Web Api with a class controller, depends to Loader, URL, Router, (*10)

MVC : add all components to build a MVC app like a view builder, depends to Loader, Hook, URL, Routes, (*11)

App : manage a web app built on a MVC pattern with a class controller, depends to Loader, Hook, URL, Routes, MVC, (*12)

HTMLhelpers : helpers to build html forms, no dependencies, (*13)

CSSmin : minify CSS, depends to Loader, Hook, MVC, (*14)

Functions

String parser : strip_accents, strip_specialchars, beautify, minimize, excerpt, is_email, is_phone_fr, is_date, datetime, sanitize_output, (*15)

File manager / Shorcuts : getperms, filename, extension, upload, download, (*16)

CURL : url_get_contents, (*17)

key : Key_Generator, (*18)

Required PHP version and modules

  • PHP v5.3 or higher installed on your server or web hosting, (*19)

  • htaccess (for Apache) and url_rewriting PHP modules, (*20)

Installation

Composer

Nemesis-Framework is now on packagist, so it can be required as a dependency with Composer :, (*21)

https://packagist.org/packages/kimihub/nemesis-framework, (*22)

URL Rewriting Configuration

For Apache Servers the content of the .htaccess file located to the server root directory is :, (*23)

<IfModule mod_rewrite.c>
    #Symlinks maybe needed for URL rewriting
    Options +FollowSymLinks
    RewriteEngine On
    #if you want to exclude some directories from url rewriting
    #RewriteCond %{REQUEST_URI} !^/(site2|site3/.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

And for Lighttpd Servers the content of Lighttpd.conf :, (*24)

$HTTP["host"]  =~ "www\.mydomain\.com"{
    server.document-root = "/PathToServerRoot/"
    accesslog.filename   = "/PathToLogs/access.log"
    url.rewrite = (
        "^/(.+)/?$" => "/index.php/$1"
    )
}

index.php instructions

Require bootstraper, (*25)

require_once 'nemesis.php';

To log php errors, (*26)

get_errors(); // to view errors.log : http://mydomain.com/errors.log

To display php errors, (*27)

display_errors();

If the core functions are required, (*28)

core_functions();

If the autoloader is required, (*29)

core_autoloader();

Router initialization, (*30)

$loader = Loader::getInstance();
$loader->initClass('Router');

Example of a web app initialization, (*31)

$blogApp = App::getInstance('blog', '1.0'); // the version is not required
$blogApp->run();
echo $blogApp;

More examples

For more examples, check the others repositories prefixed with "nemesis-", (*32)

Changelog

0.7

  • Add Api::RESTMethods()
  • Implements HTMLhelpers old plugin to class.HTMLhelpers.php core
  • Implements CSSmin old plugin to class.CSSmin.php core
  • Cleans App and MVC to implement NEMESIS_PROCESS_PATH

0.6

  • Move the bootstraper core/bootstrap.php to ./nemesis.php for more simplicity with Composer
  • Move core/errors.log to ./errors.log
  • Add ./nemesis.dev.php to write logs in the errors file when included
  • Add NEMESIS_PROCESS_PATH to ./nemesis.php and core/class.App.php
  • Change behaviour of App system, an app can now be in the root server directory
  • Deprecated App::setAsDefault() and App::$url
  • Deprecated class.Plugin.php
  • Defines composer.json

0.5

  • New function in functions.php : key_generator($length=8)
  • Removed hash/token generator and new secure ($_SESSION[$sessionName] = $expirationDate)
  • Add Cross-Origin Resource Sharing (CORS) headers in class.Api.php with Api::CORS()

0.4

  • New class : class.Api.php to manage a JSON Web Api
  • New class : class.Session.php to manage a secure session

0.3

  • Simplification, re-organization of classes dependencies
  • init.php replaced with bootstrap.php, it is now clean and
  • new way to instance plugins and apps independently from Loader Class
  • Routes configuration has now its own class with URL Class dependence
  • Loader class can initialize a class with a initClass method
  • errors.log changes its path to /core/errors.log
  • core_functions() and core_loader() appears in bootstrap to include the required libraries

0.2

  • Test on Lighttpd / Fixed url rewriting

0.1

  • Initial Release

The Versions

10/04 2015

dev-master

9999999-dev https://github.com/kimihub/nemesis-framework

Small PHP5 Framework

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0

 

framework rest mvc

10/04 2015

0.7.6

0.7.6.0 https://github.com/kimihub/nemesis-framework

Small PHP5 Framework

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0

 

framework rest mvc