No indication that it was required (on project page or README.md) or instructions on how to install. After running "composer install" inside the csv_serialization directory, vendor was created successfully, but enabling the module still failed with "CSV Serialization requires the League\Csv library."

CommentFileSizeAuthor
#7 2.png2.74 KBXerraX
#7 1.png2.35 KBXerraX

Comments

Morbus Iff created an issue. See original summary.

morbus iff’s picture

Issue summary: View changes
grasmash’s picture

Status: Active » Fixed

Documentation has been added to the project page regarding this requirement.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

XerraX’s picture

Status: Closed (fixed) » Needs work

Module wont enable with error "CSV Serialization requires the League\Csv library." even composer installed it in modules vendor path.

grasmash’s picture

Have you followed the instructions for Using Composer in Drupal? What build methodology are you using?

XerraX’s picture

StatusFileSize
new2.35 KB
new2.74 KB

I ran "composer install" in drupal root and then in this module's folder. Structure is now like this:

sites\all\modules\csv_serialization\vendor\league\csv
1

sites\all\modules\csv_serialization\vendor\league\csv\src
2

XerraX’s picture

Ok i found this tutorial for composer manager, and it installed the dependencies properly.

But now i've lost track of the files i will need to upload to the live site, where composer is not available...

XerraX’s picture

Status: Needs work » Closed (works as designed)

nevermind, got composer installed on live

chrotto’s picture

I am following the instructions in the tutorial you referred to but I do not manage to get the composer manager initialized.
No errors and nothing seams to happen.
The composer is working properly for me but it looks like init.php in composer_manager/scripts directory is not working. The script is starting but gives no output.

chrotto’s picture

Sorry
I had to run init.php from the composer_manager directory.
Now it works.

chrotto’s picture

I managed to install this module locally. But I do not managed to install the composer on my live site.
I copied the /vendor/league directory from my local site to the live site but when installing CSV Serialization I get this error:
CSV Serialization requires the League\Csv library.
What more do I have to do?

ehanuise’s picture

This is more complex than it should be, not practical for sites where you do not have ssh access to the server, and out of reach for non-developpers/sysadmins.

I had to google to eventually find that composer is a separate software that needs be installed to the server.

root@www:/home/www.example.com# composer install
bash: composer: command not found
root@www:/home/www.example.com# apt-get install composer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package composer

I found these install instructions : https://getcomposer.org/download/

root@www:/home/www.example.com# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
root@www:/home/www.example.com# php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
root@www:/home/www.example.com# php composer-setup.php
All settings correct for using Composer
Downloading 1.1.3...

Composer successfully installed to: /home/www.example.com/composer.phar
Use it: php composer.phar
root@www:/home/www.example.com# php -r "unlink('composer-setup.php');"

After that I think I have installed the league/csv ? At leats the module can be enabled in drupal without complaining the league/csv library is missing

root@www:/home/www.example.com# ./composer.phar install
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
root@www:/home/www.example.com# ./composer.phar install league/csv
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Invalid argument league/csv. Use "composer require league/csv" instead to add packages to your composer.json.
root@www:/home/www.example.com# ./composer.phar require league/csv
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Using version ^8.1 for league/csv
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing league/csv (8.1.0)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
root@www:/home/www.example.com# 

Why is this so complex and different from the usual 'download the library at this location and place it in /libraries or /sites/all/libraries ?

(I'm not a developer. I only have a basic understanding of PHP coding, so I approach this from a drupal user point of view, not the point of view of an experienced drupal developper.)

ehanuise’s picture

Status: Closed (works as designed) » Needs work
grasmash’s picture

Status: Needs work » Closed (works as designed)

Yes, composer is separate software. It will be a requirement of Drupal core in 8.2, as Drupal itself uses composer to manage external dependencies. It is the de facto dependency manager for the PHP community.

It is not legal to ship league/csv with this module, so it must be defined as a separate dependency and downloaded via composer by the implementing developer.

Please follow the referenced instructions provided on Drupal.org for using composer to manage Drupal dependencies. I personally do not recommend using composer_manager.

If you do not have access to your hosting environment, then simply commit your vendor directory to your git repository.

romel.adodis’s picture

Those who are new to Drupal 8,
Install the composer normally

Step 1:
Modify the composer.json file in your docroot and add the below line under "require" section(append below line if some other library/module already exist)

"require": {
"drupal/csv_serialization": "^1.0"
},

Step 2:
Run "composer require drupal/csv_serialization" from the "docroot directory" in command prompt.

-------------

For "Windows Acquia dev desktop users" if Composer command is not working

try the below in the cmd,
1) cd "sites_doc_root_dir"
2) php.exe "c:/Program Files (x86)/DevDesktop/tools/composer.phar" require drupal/csv_serialization