Class ‘PHPExcel_Writer_csv’ not found

PHP Excelでexcelからcsvへの変換しようと以下のように書くと

set_include_path(get_include_path() . PATH_SEPARATOR . "vendor/phpoffice/phpexcel/Classes/");
include "PHPExcel.php";
include "PHPExcel/IOFactory.php";

$objReader = PHPExcel_IOFactory::createReader('Excel5');
$excel = $objReader->load('csv/edinetlist.xls');

$writer = PHPExcel_IOFactory::createWriter($excel, 'csv');
$writer->save('csv/edinetlist.xls');

なに!?
Class ‘PHPExcel_Writer_csv’ not found in /home/vagrant/equity/vendor/phpoffice/phpexcel/Classes/PHPExcel/IOFactory.php on line 141

githubを見ると、


The Writer names are case-sensitive
so you’d need to specify the Writer name correctly as ‘CSV’ rather than ‘csv’
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, ‘CSV’);

なるほど、以下で上手くいきます。

$writer = PHPExcel_IOFactory::createWriter($excel, 'CSV');