Skip to content

Commit

Permalink
doc: Add a doc entry to help out the case when the shipped PHAR conta…
Browse files Browse the repository at this point in the history
…ins Box

Closes #924
  • Loading branch information
theofidry committed Oct 15, 2023
1 parent 016000f commit ccdc8f2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
1. [The PHP_SAPI check](#the-php_sapi-check)
1. [Autoloading Composer](#autoloading-composer)
2. [Detecting that you are inside a PHAR](#detecting-that-you-are-inside-a-phar)
3. [Building a PHAR with Box as a dependency](#building-a-phar-with-box-as-a-dependency)


## What is the canonical way to write a CLI entry file?
Expand Down Expand Up @@ -121,13 +122,37 @@ $isInPhar = '' !== Phar::running(false);
See [Phar::running()][phar-running] for more information.


## Building a PHAR with Box as a dependency

If you need to include Box as part of your dependencies and include it within your PHAR, you will probably encounter
the following issue when building your PHAR:

```
Could not dump the autoloader.
[...]
Could not scan for classes inside "/path/to/vendor/humbug/php-scoper/vendor-hotfix/" which does not appear to be a file nor a folder
```

This is because by default, Box does not include VCS or dot files which results in the directory `vendor/humbug/php-scoper/vendor-hotfix/`
to be excluded (as it becomes an empty directory). To circumvent that, you will likely need:

```json
{
"directories": ["vendor/humbug/php-scoper/vendor-hotfix"]
}
```

Note that as a result you may want to use the [`force-autodiscovery`][force-autodiscovery] setting.


<br />
<hr />

« [Symfony supports](symfony.md#symfony-support)[Table of Contents](/) »


[httpoxy]: https://httpoxy.org/
[force-autodiscovery]: ./configuration.md#force-auto-discovery-force-autodiscovery
[phar-running]: https://www.php.net/manual/en/phar.running.php
[phpdbg]: https://www.php.net/manual/en/intro.phpdbg.php
[php-sapi-name]: https://www.php.net/manual/en/function.php-sapi-name.php
Expand Down

0 comments on commit ccdc8f2

Please sign in to comment.