编译安装

Unix

Ubuntu
  1. # 依赖
  2.  
  3. sudo apt-get install -y zlib1g-dev
  4.  
  5. # 扩展
  6.  
  7. git clone https://github.com/viest/php-ext-excel-export.git
  8.  
  9. cd php-ext-excel-export
  10.  
  11. git submodule update --init
  12.  
  13. phpize && ./configure --with-php-config=/path/to/php-config
  14.  
  15. make && make install
  16.  
  17. # 添加 extension = xlswriter.so 到 ini 配置
Mac
  1. # 依赖
  2.  
  3. brew install zlib
  4.  
  5. # 扩展
  6.  
  7. git clone https://github.com/viest/php-ext-excel-export.git
  8.  
  9. cd php-ext-excel-export
  10.  
  11. git submodule update --init
  12.  
  13. phpize && ./configure --with-php-config=/path/to/php-config
  14.  
  15. make && make install
  16.  
  17. # 添加 extension = xlswriter.so 到 ini 配置

Windows

依赖
请预先搭建PHP编译环境,教程详见 php.net
  1. cd PHP_BUILD_PATH/deps
  2.  
  3. DownloadFile http://zlib.net/zlib-1.2.11.tar.gz
  4. 7z x zlib-1.2.11.tar.gz > NUL
  5. 7z x zlib-1.2.11.tar > NUL
  6. cd zlib-1.2.11
  7. cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_C_FLAGS_RELEASE="/MT"
  8. cmake --build . --config "Release"
扩展
  1. cd PHP_PATH/ext
  2.  
  3. git clone https://github.com/viest/php-ext-excel-export.git
  4.  
  5. cd EXT_PATH
  6.  
  7. git submodule update --init
  8.  
  9. phpize
  10.  
  11. configure.bat --with-xlswriter --with-extra-libs=PATH\zlib-1.2.11\Release --with-extra-includes=PATH\zlib-1.2.11
  12.  
  13. nmake