dioscouri/f3-lib

F3 框架的库

v0.9.0 2015-09-01 21:40 UTC

This package is not auto-updated.

Last update: 2024-09-20 07:46:24 UTC


README

F3 框架的库 链接,该库旨在使用 fatfree 作为强大的基础,并在其之上添加文件和功能,以快速创建应用程序。有一个强大的应用程序社区,用于解决常见问题。

该库是独立的,并且可以使用 composer 快速添加到您的仓库中

Add this to your project's composer.json file:

{
    "require": {
        "dioscouri/f3-lib": "dev-master"
    }
}

然后,在 $app->run(); 前立即在您的 index.php 文件中添加以下两行

// bootstap each mini-app
\Dsc\Apps::instance()->bootstrap();

// trigger the preflight event
\Dsc\System::instance()->preflight(); 

示例 index.php 文件

<?php
//AUTOLOAD all your composer libraries now.
(@include_once (__dir__ . '/../vendor/autoload.php')) OR die("You need to run php composer.phar install for your application to run.");
//Require FatFree Base Library https://github.com/bcosca/fatfree
$app = Base::instance();
//Set the PATH so we can use it in our apps
$app->set('PATH_ROOT', __dir__ . '/../');
//This autoload loads everything in apps/* and 
$app->set('AUTOLOAD',  $app->get('PATH_ROOT') . 'apps/;');
//load the config files for enviroment
require $app->get('PATH_ROOT') . 'config/config.php';
//SET the "app_name" or basically the instance so we can server the admin or site from same url with different loaded classes
$app->set('APP_NAME', 'site');
if (strpos(strtolower($app->get('URI')), $app->get('BASE') . '/admin') !== false)
{
    $app->set('APP_NAME', 'admin');
    //stupid javascript bugs with debug off
    $app->set('DEBUG', 1);
}
// bootstap each mini-app  these are in apps folder, as well as in vender/dioscouri
\Dsc\Apps::instance()->bootstrap();
// load routes; Routes are defined by their own apps in the Routes.php files
\Dsc\System::instance()->get('router')->registerRoutes();
// trigger the preflight event PreSite, PostSite etc
\Dsc\System::instance()->preflight();
//excute everything.
$app->run();

apps

该库旨在启动 "apps",应用程序只是捆绑了功能的代码组,例如,f3-blog 将为您的应用程序提供一个简单的博客平台。

您的主题和自定义站点将作为自定义应用程序构建以满足您的需求。

默认文件夹结构如下所示

/apps /config /public /tmp

您的 index.php 文件位于 public 中,因为 public 是唯一的网络可访问文件夹。

[待办事项] 详细说明如何构建自定义应用程序

主题

自定义主题的详细信息

网络服务器

添加到 NGINX 和 APACHE 的配置