diff --git a/README.md b/README.md index 185fd99..40a21d4 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ Exit code | Name | Description ## Tips for use - The PHAR file tries to [mount](https://secure.php.net/manual/en/phar.mount.php) directories outside of the `vendor/` directory and is currently only tested for paths directly one level above the `vendor/` directory. If you rely in some way on paths from outside of the root directory of the project, autoload may not work. - I think that the most useful would be to generate autoloading with the option `--classmap-authoritative` for production. To make autoloading from a PHAR file work, I rewrite the generated file indexes, so it may not work for dynamic file guessing and searching. +- Watch out when using whole archive compression. Although it provides better compression ratio, it also comes with additional hack for decompressing files (overrides custom `stub.php` script) which might break autoloading. Files compression is a bit more reliable here. ## Plans for future - Remove unnecessary whitespaces (a.k.a finish `\Donatorsky\VendorCompress\FileProcessors\StripWhitespacesPhpFileProcessor`) diff --git a/bin/vendor-compress b/bin/vendor-compress index a8f42f6..1f1c844 100644 --- a/bin/vendor-compress +++ b/bin/vendor-compress @@ -117,7 +117,8 @@ if (!\defined('VENDOR_COMPRESS_COMPOSER_INSTALL')) { exit(VENDOR_COMPRESS_ERR_PROJECT_NOT_SET_UP); } -\define('VENDOR_COMPRESS_COMPOSER_PHAR', \dirname(VENDOR_COMPRESS_COMPOSER_INSTALL) . DIRECTORY_SEPARATOR . 'vendor.phar'); +\define('VENDOR_COMPRESS_PROJECT_ROOT', \dirname(VENDOR_COMPRESS_COMPOSER_INSTALL) . DIRECTORY_SEPARATOR); +\define('VENDOR_COMPRESS_COMPOSER_PHAR', VENDOR_COMPRESS_PROJECT_ROOT . 'vendor.phar'); // Fix user input $usingFallbackConfig = false; @@ -132,6 +133,8 @@ if (null !== $configurationOption) { exit(VENDOR_COMPRESS_ERR_INACCESSIBLE_CONFIGURATION_FILE); } } elseif ( + !\is_file($configurationOption = VENDOR_COMPRESS_PROJECT_ROOT . '.vendor_compress') && + !\is_file($configurationOption = VENDOR_COMPRESS_PROJECT_ROOT . '.vendor_compress.dist') && !\is_file($configurationOption = \getcwd() . DIRECTORY_SEPARATOR . '.vendor_compress') && !\is_file($configurationOption = \getcwd() . DIRECTORY_SEPARATOR . '.vendor_compress.dist') ) { diff --git a/composer.json b/composer.json index 80536f6..4cd8daa 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ ], "require": { "php": ">=7.1", + "ext-Phar": "*", "ext-json": "*" }, "require-dev": {