install phpexcel using composer in thinkPHP

Environment

  • Window 10.1
  • XAMPP 7.0.9 (PHP 7.0.9)
  • thinkPHP 5.0.1

Steps

# visit https://getcomposer.org/download/
> php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
> php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
> php composer-setup.php
> php -r "unlink('composer-setup.php');"

# make sure you are in the root dir of thinkphp
# edit the composer.json file,
# add `"PHPOffice/PHPExcel": "1.8.*"` in the "require"
# save and exit
php composer.phar require PHPOffice/PHPExcel
# or 
php composer.phar require
# to search for the package you want to install
原文地址:https://www.cnblogs.com/raybiolee/p/5954396.html