From 04f00e825445e70110d296e304aada1cdc175015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20J=C3=B8rgensen?= Date: Mon, 23 Nov 2026 21:12:41 +0100 Subject: [PATCH] build: leave PHPStan and Larastan out of the release PHAR The PHAR bundles development packages because laravel-zero/framework is one, as Laravel Zero's Packagist instructions require. PHPStan, pulled in by Larastan, made up 69% of it. box.json now packs vendor/ without those two packages and rebuilds the autoloader, since PHPStan registers a bootstrap file that every start would otherwise load. The 0.3.0 PHAR shrinks from 45.9 MB to 14.5 MB; its command list, default screen and help output are identical to the unshrunk build. Co-Authored-By: Claude Opus 5.5 --- RELEASING.md | 6 ++++++ box.json | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 39c6586..833ced9 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -3,6 +3,12 @@ Packagist installs the committed `builds/quickpay` PHAR. A release is built once, reviewed by `Quality`, committed, tagged, and published manually. +The PHAR bundles every package in `vendor/`, development packages included, +because `laravel-zero/framework` is a development dependency that the PHAR runs +on. `box.json` leaves out PHPStan and Larastan, which would otherwise make up +most of the PHAR. Leave out any large development tool added later in the same +place, and check the PHAR's size after building. + ## One-time setup - Connect the GitHub repository to Packagist. diff --git a/box.json b/box.json index 43301cc..120dae6 100644 --- a/box.json +++ b/box.json @@ -3,19 +3,27 @@ "directories": [ "app", "bootstrap", - "config", - "vendor" + "config" ], "files": [ "composer.json" ], "exclude-composer-files": false, - "dump-autoload": false, + "dump-autoload": true, "exclude-dev-files": false, "check-requirements": true, "output": "quickpay.phar", "compression": "GZ", "compactors": [ "KevinGH\\Box\\Compactor\\Php" + ], + "finder": [ + { + "in": "vendor", + "exclude": [ + "phpstan/phpstan", + "larastan/larastan" + ] + } ] }