Skip to content

Documentation: add warning about Composer 2.3 #656

@jrfnl

Description

@jrfnl

👋🏻 Hiya,

I'm not sure where to add this, but I believe it would be prudent to add a warning somewhere in the documentation about Composer 2.3.

Context

Composer 2.3 drops support for PHP 7.2 and the autoload files generated with Composer 2.3 are no longer compatible with PHP < 7.0.

The problem

A lot of projects which create PHAR files will include the composer autoload files in the PHAR and use them for the autoloading of the files within the PHAR.

If a project does so AND needs their PHAR to be runnable of PHP < 7.0, this will break if Composer 2.3 was used to prepare the files to be boxed up.

As Box itself has a minimum of PHP 7.4 and the PHAR file is often generated via a GH Actions workflow, this can be problematic as Composer 2.3 will be installed by default on PHP 7.2+.

The solution

The solution is quite straight-forward: make sure Composer 2.2 is used to prepare the files to be boxed up.

In GH Actions, this would typically be done like this (specifically the last two lines):

       - name: Setup PHP
         uses: shivammathur/setup-php@v2
         with:
           php-version: 8.0
           extensions: exif, phar, openssl
           ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On, zend.assertions=1
           # Autoload files generated with Composer 2.3 are not compatible with PHP < 7.0.
           tools: composer:2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions