LoginSignup
1
1

More than 3 years have passed since last update.

Windows10にXampp環境を入れてphpspreadsheetが使えるまで

Last updated at Posted at 2020-04-24

Windows10でphpspreadsheetの導入

1.Xamppのインストール

 下記からインストーラーをダウンロード
 https://www.apachefriends.org/jp/download.html
 ※インストール先はc:\にした
 c:\にxamppフォルダができる。
 ちなみに、localhostのルートディレクトリは\xampp\htdocs

2.composerのインストール

 下記参照
 https://qiita.com/mikoski01/items/266469535e860312145d
 php のバージョン云々を聞いてくるけど、Xamppにインストール済みのものと一致していればOKかな?(適当)
PHPのパスを聞いてくるけどXamppでOK

3.phpspreadsheetのインストール

 プロンプトから適当なディレクトリに移動して、以下をコマンドを実行。


c:¥User> composer require phpoffice/phpspreadsheet
Using version ^1.11 for phpoffice/phpspreadsheet
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Installing psr/simple-cache (1.0.1): Downloading (100%)
  - Installing markbaker/matrix (1.2.0): Downloading (100%)
  - Installing markbaker/complex (1.4.8): Downloading (100%)
  - Installing phpoffice/phpspreadsheet (1.11.0): Downloading (100%)
phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing tecnickcom/tcpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for rendering charts, or including charts with PDF or HTML Writers)
Writing lock file
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!

C:¥User>

 カレントディレクトリに「vendor」フォルダとcomposer.jsonができていればOK
 jsonファイル内にphpspreadsheetの記述があるはず。
 
 phpから呼び出す場合には、上でできたvendor内の「autoload.php」を使用したいphpファイル内で読み込む。

require_once("/Users/vendor/autoload.php");

 これで使える筈

 環境によっては、xamppのApacheサーバーが使用するポート(大体80?)がwindowsのほかのアプリと競合して動かないこともあるらしい。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1