"Fossies" - the Fresh Open Source Software Archive

Member "ILIAS-5.4.9/libs/composer/README.md" (24 Jan 2020, 3827 Bytes) of package /linux/www/ILIAS-5.4.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

ILIAS composer guidelines

New dependencies MUST be approved by the Jour Fixe of the ILIAS society.

Composer dependency management

Composer distinguishes between two different category of dependencies the production and dev dependencies.

The production dependencies are saved in the require section of the composer.json configuration. These are used by the production code of ILIAS. Tests and other development logic don’t use this libraries directly.

The dev dependencies are saved in the require-dev section of the compser.json configuration. These are libraries and tools dedicated to aid the development process. For example PHPUnit to run and create unit tests.

Dependencies for production

"filp/whoops" : {
  "source" : "github.com/filp/whoops",
  "used_version" : "v2.1.0",
  "wrapped_by" : null,
  "added_by" : "Denis Klöpfer <denis.kloepfer@concepts-and-training.de>",
  "last_update" : "2016-03-22",
  "last_update_by" : "Jörg Lützenkirchen <luetzenkirchen@leifos.com>",
  "approved-by": "Jour Fixe",
  "approved-date": "YYYY-MM-DD"
},

Dependencies for development

Update a single dependency

Remove a dependency

Production

A production dependency can be removed with the following command:

composer remove <DEPENDENCY_NAME>

Afterwards all changes should be committed.

Development

A development dependency can be removed with the following command:

composer remove --dev <DEPENDENCY_NAME>

Afterwards all changes should be committed.

Updating Class-Map

The composer classmap holds information (besides the PHP-dependencies) on all ILIAS-classnames and provides autoloading for them. There is no need to require_once or include_once ILIAS-Classes anymore. Whenever a new ILIAS-Class in /Services/* or /Modules/* is introduced, the classmap should be updated with the following command.

$ composer dump-autoload

Create library patch

New patches in dependencies MUST be confirmed by the Technical Board of the ILIAS society.

The composer plugin cweagans/composer-patches provides a way to apply patches to dependencies. - First a patch has to be created with git which contains all the required changes. After the has to be moved to the .libs/composer/patches directory. - Second create a patch entry in the composer.json. The patch section is located under extra->patches.

For example the patch entry for tcpdf looks like this:

{
    "tecnickcom/tcpdf": {
                "ILIAS TCPDF Patches": "patches/tcpdf.patch"
            }
}

First the name of the library must be specified and as child all patches which should be applied to the library. The example shown above has only one patch with the description “ILIAS TCPDF Patches” and the location “patches/tcpdf.patch”.

Now composer applies the patch after the specified dependency is installed. The output will look similar as the example shown bellow:

Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing tecnickcom/tcpdf (6.2.12): Downloading (100%)         
  - Applying patches for tecnickcom/tcpdf
    patches/tcpdf.patch (ILIAS TCPDF Patches)