microphork/application

此包已被废弃,不再维护。未建议替代包。
最新版本(v1.0.0)的此包没有可用的许可证信息。

用于启动新的microphork应用的安装程序

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

简介

这是一个基于 Composer 的安装程序,用于创建microphork应用。如果您不想使用Composer,可以直接克隆 microphork框架 仓库。

使用方法

首先确保Composer已 安装。然后在终端中执行 composer create-project 命令

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

这将下载microphork框架及其依赖项到名为 my-microphork-app 的文件夹,并创建一个全新的 app 目录,该目录应用于您的应用程序文件。请确保 logs 目录具有写入权限。

接下来将您的浏览器指向 htdocs/index.php 文件。建议将服务器的文档根设置为 htdocs 目录,并设置URL重写以指向 index.php。

如果您需要覆盖任何路径常量,可以创建一个 htdocs/env.php 文件。这将自动在应用程序运行之前包含。下面提供了一个示例env.php文件,其中显示了一些可以使用的覆盖。

示例 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));

鸣谢

ElenorPhork Labs 构建。

许可证

在 The MIT License 下许可 https://open-source.org.cn/licenses/mit-license.php