diff --git a/README.md b/README.md index 8a1b410a..75f2f20c 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,14 @@ www WEB部署目录(或者子目录) │ ├─mode 应用模式目录 │ ├─tpl 系统模板目录 │ ├─tests 单元测试文件目录 -│ ├─vendor 第三方类库目录 │ ├─base.php 基础定义文件 │ ├─convention.php 框架惯例配置文件 │ ├─helper.php 助手函数文件 │ ├─phpunit.xml phpunit配置文件 │ └─start.php 框架入口文件 +│ +├─extend 扩展类库目录 +├─vendor 第三方类库目录(Composer依赖库) ~~~ > router.php用于php自带webserver支持,可用于快速测试 diff --git a/base.php b/base.php index 4638313c..db918e7f 100644 --- a/base.php +++ b/base.php @@ -17,20 +17,20 @@ define('THINK_VERSION', '5.0.0 RC2'); // 系统常量 defined('DS') or define('DS', DIRECTORY_SEPARATOR); defined('THINK_PATH') or define('THINK_PATH', dirname(__FILE__) . DS); +defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS); +defined('ROOT_PATH') or define('ROOT_PATH', dirname(APP_PATH) . DS); defined('LIB_PATH') or define('LIB_PATH', THINK_PATH . 'library' . DS); -defined('EXTEND_PATH') or define('EXTEND_PATH', THINK_PATH . 'extend' . DS); +defined('EXTEND_PATH') or define('EXTEND_PATH', ROOT_PATH . 'extend' . DS); defined('MODE_PATH') or define('MODE_PATH', THINK_PATH . 'mode' . DS); // 系统应用模式目录 defined('CORE_PATH') or define('CORE_PATH', LIB_PATH . 'think' . DS); defined('TRAIT_PATH') or define('TRAIT_PATH', LIB_PATH . 'traits' . DS); -defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS); -defined('ROOT_PATH') or define('ROOT_PATH', dirname(APP_PATH) . DS); defined('APP_NAMESPACE') or define('APP_NAMESPACE', 'app'); defined('COMMON_MODULE') or define('COMMON_MODULE', 'common'); defined('RUNTIME_PATH') or define('RUNTIME_PATH', ROOT_PATH . 'runtime' . DS); defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH . 'log' . DS); defined('CACHE_PATH') or define('CACHE_PATH', RUNTIME_PATH . 'cache' . DS); defined('TEMP_PATH') or define('TEMP_PATH', RUNTIME_PATH . 'temp' . DS); -defined('VENDOR_PATH') or define('VENDOR_PATH', THINK_PATH . 'vendor' . DS); +defined('VENDOR_PATH') or define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS); defined('EXT') or define('EXT', '.php'); defined('MODEL_LAYER') or define('MODEL_LAYER', 'model'); defined('VIEW_LAYER') or define('VIEW_LAYER', 'view'); diff --git a/composer.json b/composer.json index 1e330ebe..6a23e52a 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,12 @@ { "name": "topthink/framework", "description": "the new thinkphp framework", - "type": "thinkphp-framework", - "keywords": ["framework", "thinkphp", "ORM"], + "type": "think-framework", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], "homepage": "http://thinkphp.cn/", "license": "Apache-2.0", "authors": [ @@ -12,7 +16,8 @@ } ], "require": { - "php": ">=5.4.0" + "php": ">=5.4.0", + "topthink/think-installer": "*" }, "require-dev": { "johnkary/phpunit-speedtrap": "^1.0", @@ -21,5 +26,6 @@ "phpunit/phpunit": "4.8.*", "sebastian/phpcpd": "*", "squizlabs/php_codesniffer": "2.*" - } + }, + "minimum-stability": "dev" } diff --git a/extend/.gitignore b/extend/.gitignore deleted file mode 100644 index c96a04f0..00000000 --- a/extend/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/mode/console.php b/mode/console.php index fcb3cb0d..a4aff296 100644 --- a/mode/console.php +++ b/mode/console.php @@ -23,7 +23,8 @@ return [ ], // 别名定义 'alias' => [ - 'think\Error' => MODE_PATH . 'console/Error' . EXT, + 'think\App' => MODE_PATH . 'console/App' . EXT, + 'think\Error' => MODE_PATH . 'console/Error' . EXT ], // 配置文件 'config' => [ diff --git a/mode/console/App.php b/mode/console/App.php new file mode 100644 index 00000000..4c1c13fe --- /dev/null +++ b/mode/console/App.php @@ -0,0 +1,43 @@ + +// +---------------------------------------------------------------------- + +namespace think; + + +use think\Console; + +class App +{ + /** + * 执行应用程序 + * @access public + * @return void + */ + public static function run() + { + // 实例化console + $console = new Console('Think Console', '0.1'); + // 读取指令集 + if (is_file(APP_PATH . 'command' . EXT)) { + $commands = include APP_PATH . 'command' . EXT; + if (is_array($commands)) { + foreach ($commands as $command) { + if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) { + // 注册指令 + $console->add(new $command()); + } + } + } + } + // 运行 + $console->run(); + } +} \ No newline at end of file diff --git a/vendor/.gitignore b/vendor/.gitignore deleted file mode 100644 index c96a04f0..00000000 --- a/vendor/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file