diff --git a/.gitignore b/.gitignore index 6daa427..7326d16 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ vendor node_modules .tmp_staging + +yarn-error.log diff --git a/README-CN.md b/README-CN.md index b01a257..b4dbfc9 100644 --- a/README-CN.md +++ b/README-CN.md @@ -649,16 +649,11 @@ require('runtime/build/App.20170505085503.phar'); **网站服务模式:** +快速开始一个demo: ``` -步骤 1: yarn install -步骤 2: DOMAIN=http://localhost:666 npm run demo -步骤 3: cd public && sudo php -S localhost:666 - -访问网站:http://localhost:666/index.html -访问接口:http://localhost:666/Demo/Index/hello - -demo如下: +php cli --run ``` +demo如下:

diff --git a/README.md b/README.md index 08edf3d..4b608b6 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ password = easyphp All output is json in the framework, neithor framework's core error or business logic's output, beacuse I think is friendly. -# Request param check, Support require/length/number check at present. Use as follows: +##### Request param check, Support require/length/number check at present. Use as follows: ``` $request = App::$container->getSingle('request'); $request->check('username', 'require'); @@ -646,16 +646,12 @@ Run: **Web Server Mode:** +Quick Start: ``` -step 1: yarn install -step 2: DOMAIN=http://localhost:666 npm run demo -step 3: cd public && sudo php -S localhost:666 - -visit web:http://localhost:666/index.html -visit api:http://localhost:666/Demo/Index/hello - -demo as follows: +php cli --run ``` +demo as follows: +

**Cli Mode:** diff --git a/cli b/cli index df19f87..f0ccb18 100644 --- a/cli +++ b/cli @@ -14,6 +14,8 @@ * cli模式 * * 在php cli模式下运行框架运行框架 + * + * 快速开始demo: php cli --run */ // php cli --env= --= --= ... // \033[33m env \033[0m: Script run environment @@ -36,11 +38,8 @@ $help = function () { \033[33m arguments \033[0m: Input arguments \033[33m help \033[0m: Display command list - \033[36m Web Server Usage \033[0m: - step 1: cd public - step 2: php -S : - - For example, php -S 'localhost:666', after that open website 'http://localhost:666/' + \033[36m Quick start demo \033[0m: + php cli --run \033[32mEasy PHP: A Faster Lightweight Full-Stack PHP Framework. Version 0.7.0\033[0m @@ -51,6 +50,13 @@ HELP; die($string); }; +/** + * 快速开始demo + */ +$demo = function () { + shell_exec('./run'); +}; + /** * 获取参数 */ @@ -65,6 +71,9 @@ foreach ($argv as $v) { if ($match[0] === 'help') { $help(); } + if ($match[0] === 'run') { + $demo(); + } if (isset($match[1])) { $input[$match[0]] = $match[1]; } diff --git a/public/index.php b/public/index.php index ee2df0e..0657da0 100644 --- a/public/index.php +++ b/public/index.php @@ -7,7 +7,7 @@ * TIERGB * * * * * - * Version: 0.6.9 * + * Version: 0.7.0 * ********************************************/ // 载入框架运行文件 diff --git a/run b/run new file mode 100755 index 0000000..a15425f --- /dev/null +++ b/run @@ -0,0 +1,18 @@ +#! /bin/bash +# Run this framework demo + +# step 1 +yarn install + +# step 2 +DOMAIN=http://localhost:60000 npm run demo + +# step 3 +# mac os +open "http://localhost:60000/index.html" +# linux os +xdg-open "http://localhost:60000/index.html" + +# step 4 +cd public && php -S localhost:60000 +