-
Notifications
You must be signed in to change notification settings - Fork 28
Add .gitattributes to exclude dev files from Composer package #13
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
Conversation
@Krinkle Looks very fine on first glance. By the type of change I get somewhat the impression that this is not only for this specific package. So could you add a bit of context to this PR why each directory has been chosen? Especially if this is about Net_URL2 only or is more in the general structure of Pear package projects? |
@ktomk Indeed, this is not specific to the Most dependencies that Wikipedia uses via Composer seem to make their exports relatively minimal and are at least loosely aware of how Packagist exports it from Git. For Pear projects, I suspect this has not been taken to account simply because it isn't (historically) the main way these projects are distributed. So even if it was considered, it will have likely been expressed somewhere other than in This is the first Pear dependency that Wikipedia loads via Composer (we've previously loaded one or two by other means), and thus the first time I noticed it. |
@Krinkle Thanks for your response on the topic. Based on your reply I've taken the opportunity to review the changes. I think they are fine for production code-only distribution especially in context of distributing via composer and prefer-dist with Github repositories. Would you be so kind and could leave some feedback about how the overall experience is to make use of this library via composer? I ask because from what I remember when the package was ported over to Github some years ago and when adding composer support, IIRC it was needed to add the
So I'm interested if this has any implications for your use-case next to the export improvements already done. |
As someone who uses Composer, the presence of In the Composer landscape, I believe it is generally preferred not to rely on internal file paths or run-time directory scanning of this kind, in favour of mapping a namespace to a directory (PSR-4). Alternatively, you can also give it a list of files and directories and let it scan these are install-time and builds its own class-to-file map. The latter is what NET_URL2 currently uses. This means that during installation, composer finds the For the majority of existing and for all new users, I would expect See https://getcomposer.org/doc/04-schema.md#autoload for more information. Hope that helps! |
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)" Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)" Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)" Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)" Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)" Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)" Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)" Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30) Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)" Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)" Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)" Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)" Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)" Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)" Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)" Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30) Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)" Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)" Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)" Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)" Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)" Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)" Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)" Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30) Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)" Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)" Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)" Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)" Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)" Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)" Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)" Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30) Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
This omits unnececary files from the deployed package. Especially when auditing packages for production deployment, or when versioning the
vendor/
directory, this helps reduce noise.This package is currently being considered for bundling with https://github.com/Wikipedia/mediawiki (vendor). The extraneous files from
Net_URL2
stood out in a local build as most other packages seem to exclude these kinds of files.