microphork/application

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v1.0.0) of this package.

The installer used to start a new microphork application

v1.0.0 2014-03-24 00:46 UTC

This package is not auto-updated.

Last update: 2021-12-06 00:26:15 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads

Introduction

This is a Composer-based installer for creating a microphork application. If you prefer not to use Composer you can clone the microphork framework repository directly.

Usage

First make sure that Composer is installed. Then use the composer create-project command in the terminal:

composer create-project microphork/application my-microphork-app

This will download the microphork framework and its dependencies to a folder called my-microphork-app and it will create a fresh copy of the app directory which should be used for your application files. Make sure that the logs directory has write permissions.

Next point your browser to the htdocs/index.php file. It's recommended that your set your server's document root to the htdocs directory and set up URLs to rewrite to index.php.

If any of the path constants require overriding you can create an htdocs/env.php file. This will be included automatically before the rest of the application runs. An example env.php file has been provided below showing some of the overrides that can be used.

Example env.php

<?php
    //turn on the setting to display all errors
    ini_set('display_errors', 1);
    
    //define the environment (eg. dev, stage, prod)
    define('PHK_ENV', 'dev');
    
    //define the paths to the test files
    define('TEST_PATH', realpath(dirname(__DIR__)).DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR);
    define('LOG_PATH', realpath(dirname(__DIR__)).DIRECTORY_SEPARATOR.'logs/tests'.DIRECTORY_SEPARATOR);
    
    //define a custom function to load and use the testing bootstrap
    function phork_initialize() {
        require_once TEST_PATH.'classes'.DIRECTORY_SEPARATOR.'Bootstrap.php';
        class_alias('Phork\\Test\\Bootstrap', 'Phork');
    }
    
    //register a shutdown function to print all remaining errors
    register_shutdown_function(function() {
        if (class_exists('Phork') && !empty(Phork::instance()->error)) {
             if ($errors = Phork::error()->getErrors()->items()) {
                 print '<pre>'.print_r($errors, true).'</pre>';
             }
        } else {
             print 'Unable to get shutdown errors';
        }
    });
    
    //register a shutdown function to print the total execution time
    register_shutdown_function(function() {
        if (\Phork::instance()->verbose()) {
             printf('%f seconds ellapsed', (microtime(true) - PHORK_START));
        }
    });
    
    //define the start time
    define('PHORK_START', microtime(true));

Credits

Built by Elenor at Phork Labs.

License

Licensed under The MIT License http://www.opensource.org/licenses/mit-license.php