Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the documentation regarding the dump-autoload setting #225

Merged
merged 1 commit into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 5 additions & 28 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,31 +115,7 @@ Check the following [link](https://secure.php.net/manual/en/function.chmod.php)
## Check requirements (`check-requirements`)

The check requirements setting (`boolean`, `true` by default) is used to allow the PHAR to check for the application
constraint before running. For example if the application shipped in the PHAR requires PHP 7.2+ and the extension
`iconv`:

```json
{
"require": {
"php": "^7.2",
"ext-iconv": "*"
}
}
```

When running the PHAR, before running the actual application, the PHAR will check that the PHP version used is PHP 7.2+ and
that the extension `iconv` is loaded. If those requirements are not met, then a user friendly error message will be given
to the user.

This check will work for PHP 5.3+ and requires the existence of the `composer.json` or `composer.lock` file. If neither of
those files are found then the requirements check will not be added to the PHAR.

Be wary that when a `composer.lock` file is found, it will be taken as the source of truth for establishing the requirements
regardless of the content of the `composer.json`.

If a `composer.json` is found without a `composer.lock`, the it will be taken as the source of truth for establishing the
requirements regardless of whether there is no `composer.lock` because there is no dependencies or because it has been
removed.
constraint before running. See more information about it [here][requirement-checker].

**Warning**: this check is still done within the PHAR. As a result, if [the required extension to open the PHAR][compression]
due to the compression algorithm is not loaded, a hard failure will still appear: the requirement checker _cannot_ be
Expand Down Expand Up @@ -464,9 +440,9 @@ If this parameter is set, then the value of [`banner`][banner] will be discarded

## Dumping the Composer autoloader (`dump-autoload`)

By default, Box will dump the Composer autoload with the [classmap authoritative mode][composer-classmap-authoritative]
and the [`--no-dev` option][composer-no-dev-option] which disables the `autoload-dev` rules. This is however done only
if a `composer.json` file could be found.
The `dump-autoload` (`boolean`|`null`, default `true`) setting will result in Box dump the Composer autoload with the
[classmap authoritative mode][composer-classmap-authoritative] and the [`--no-dev` option][composer-no-dev-option] which
disables the `autoload-dev` rules. This is however done only if a `composer.json` file could be found.

The dumping of the autoloader will be _ignored_ if the `composer.json` file could be found.

Expand Down Expand Up @@ -592,6 +568,7 @@ The metadata (`any`) setting can be any value. This value will be stored as meta
[composer-no-dev-option]: https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
[zlib-extension]: https://secure.php.net/manual/en/book.zlib.php
[bz2-extension]: https://secure.php.net/manual/en/book.bzip2.php
[requirement-checker]: requirement-checker.md#requirements-checker


//TODO: rework the rest
Expand Down
5 changes: 5 additions & 0 deletions doc/requirement-checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ requirements are passing on the right in debug verbosity.
<img src="img/requirement-checker.png" width=900 />
</p>

**Warning**: this check is still done within the PHAR. As a result, if
[the required extension to open the PHAR][compression] due to the compression algorithm is not loaded, a hard failure
will still appear: the requirement checker _cannot_ be executed before that.


## Configuration

Expand Down Expand Up @@ -127,6 +131,7 @@ PHP 5.3+ compatible, it will fail before the requirements are being checked.


[composer]: https://getcomposer.org/
[compression]: configuration.md#compression-algorithm-compression
[check-requirements]: doc/configuration.md#check-requirements-check-requirements
[composer-platform-php]: https://getcomposer.org/doc/06-config.md#platform
[paragonie sodium_compat]: https://github.com/paragonie/sodium_compat
Expand Down