From 3709bcc5e444d66f0817b7042813b70fa0deeee4 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 31 Mar 2023 00:16:40 +0800 Subject: [PATCH] update readme --- README-en.md | 21 +++++++++++++++++++-- README.md | 25 +++++++++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/README-en.md b/README-en.md index dbf9cad9..709d99d3 100755 --- a/README-en.md +++ b/README-en.md @@ -5,6 +5,7 @@ Compile A Statically Linked PHP With Swoole and other Extensions. Compile a purely static PHP binary file with various extensions to make PHP-cli applications more portable! You can also use the micro binary file to package PHP source code and binary files into one for distribution! +This function is provided by [dixyes/phpmicro](https://github.com/dixyes/phpmicro). Note: only support cli SAPI, not support fpm, cgi. @@ -24,7 +25,8 @@ But php-static-cli only requires an environment above PHP 8.0. - Supported arch: x86_64 - Requirements: (TODO) - PHP - - Supported version: 7.4, 8.0, 8.1, 8.2 + - Supported compile version: 7.4, 8.0, 8.1, 8.2 + - Self required version: 8.0, 8.1, 8.2 ## Usage @@ -36,6 +38,8 @@ And currently you may need to clone this branch and edit GitHub Action to build. ```bash chmod +x spc +# Check system tool dependencies, and show instructions for fixing +./spc doctor # fetch all libraries ./spc fetch --all # with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI @@ -44,6 +48,8 @@ chmod +x spc ### php-cli Usage +> php-cli is a single static binary, which is similar with Go, Rust single-file binary. + When using the parameter `--build-all` or not adding the `--build-micro` parameter, the final compilation result will output a binary file named `./php`, which can be distributed and used directly. @@ -57,10 +63,13 @@ This file will be located in the directory `source/php-src/sapi/cli/`, simply co ### micro.sfx Usage +> phpmicro is a Self-Extracted Executable SAPI module, provided by [dixyes/phpmicro](https://github.com/dixyes/phpmicro). +> This project is integrated with it. + When using the parameter `--build-all` or `--build-micro`, the final compilation result will output a file named `./micro.sfx`, which needs to be used with your PHP source code like `code.php`. -This file will be located in the directory `source/php-src/sapi/micro/`, simply copy it out for use. +This file will be located in the path `buildroot/bin/micro.sfx`, simply copy it out for use. Prepare your project source code, which can be a single PHP file or a Phar file, for use. @@ -83,6 +92,8 @@ cat micro.sfx code.php > single-app && chmod +x single-app - [ ] Windows support - [X] PHP 7.4 support +More functions and features are coming soon, Bugs and TODOs: https://github.com/crazywhalecc/static-php-cli/issues/32 + ## Supported Extensions [Support Extension List](/ext-support.md) @@ -119,3 +130,9 @@ and they all have their own open source licenses. Please use the `dump-license`(TODO) command to export the open source licenses used in the project after compilation, and comply with the corresponding project's LICENSE. + +## Advanced + +This project is pure open source project, and some modules are separated for developing. + +This section will be improved after refactor version released. \ No newline at end of file diff --git a/README.md b/README.md index 1f826ec1..1ef9e209 100755 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Compile A Statically Linked PHP With Swoole and other Extensions. [English READM 编译纯静态的 PHP Binary 二进制文件,带有各种扩展,让 PHP-cli 应用变得更便携! -同时可以使用 micro 二进制文件,将 PHP 源码和 PHP 二进制构建为一个文件分发! +同时可以使用 micro 二进制文件,将 PHP 源码和 PHP 二进制构建为一个文件分发!(由 [dixyes/phpmicro](https://github.com/dixyes/phpmicro) 提供支持) 注:只能编译 CLI 模式,暂不支持 CGI 和 FPM 模式。 @@ -26,7 +26,8 @@ Compile A Statically Linked PHP With Swoole and other Extensions. [English READM - 支持架构: x86_64 - 依赖工具: (TODO) - PHP - - 支持版本: 7.4, 8.0, 8.1, 8.2 + - 支持编译版本: 7.4, 8.0, 8.1, 8.2 + - 项目依赖版本:8.0, 8.1, 8.2 ## 使用(WIP) @@ -39,6 +40,8 @@ Compile A Statically Linked PHP With Swoole and other Extensions. [English READM ```bash chmod +x spc +# 检查环境依赖,并根据提示的命令安装缺失的编译工具(TODO) +./spc doctor # 拉取所有依赖库 ./spc fetch --all # 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx @@ -47,10 +50,13 @@ chmod +x spc ### 使用 php-cli +> php-cli 是一个静态的二进制文件,类似 Go、Rust 语言编译后的单个可移植的二进制文件。 + 采用参数 `--build-all` 或不添加 `--build-micro` 参数时,最后编译结果会输出一个 `./php` 的二进制文件,此文件可分发、可直接使用。 -该文件编译后会存放在 `source/php-src/sapi/cli/` 目录中,拷贝出来即可。 +该文件编译后会存放在 `buildroot/bin/` 目录中,名称为 `php`,拷贝出来即可。 ```bash +cd buildroot/ ./php -v ./php -m ./php your_code.php @@ -58,6 +64,8 @@ chmod +x spc ### 使用 micro.sfx +> phpmicro 是一个提供自执行二进制 PHP 的项目,本项目依赖 phpmicro 进行编译自执行二进制。详见 [dixyes/phpmicro](https://github.com/dixyes/phpmicro)。 + 采用项目参数 `--build-all` 或 `--build-micro` 时,最后编译结果会输出一个 `./micro.sfx` 的文件,此文件需要配合你的 PHP 源码使用。 该文件编译后会存放在 `source/php-src/sapi/micro/` 目录中,拷贝出来即可。 @@ -82,6 +90,8 @@ cat micro.sfx code.php > single-app && chmod +x single-app - [X] Linux 支持 - [X] PHP 7.4 支持 +更多功能和特性正在陆续支持中,详见:https://github.com/crazywhalecc/static-php-cli/issues/32 + ## 支持的扩展情况 [扩展支持列表](/ext-support.md) @@ -101,8 +111,15 @@ cat micro.sfx code.php > single-app && chmod +x single-app 本项目依据旧版本惯例采用 MIT License 开源,新版本采用了部分项目的源代码做参考,特别感谢: +- [dixyes/phpmicro](https://github.com/dixyes/phpmicro)(Apache 2.0 LICENSE) - [dixyes/lwmbs](https://github.com/dixyes/lwmbs)(木兰宽松许可证) -- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)(Apache 2.0 LICENSE+SWOOLE-CLI LICENSE) +- [swoole/swoole-cli](https://github.com/swoole/swoole-cli)(Apache 2.0 LICENSE、SWOOLE-CLI LICENSE) 因本项目的特殊性,使用项目编译过程中会使用很多其他开源项目,例如 curl、protobuf 等,它们都有各自的开源协议。 请在编译完成后,使用命令 `dump-license`(TODO) 导出项目使用项目的开源协议,并遵守对应项目的 LICENSE。 + +## 进阶 + +本项目重构分支为模块化编写。 + +This section will be improved after refactor version released.