feat(packagist): prepare package for Packagist availability#47
Open
faisalahammad wants to merge 1 commit intogravityforms:masterfrom
Open
feat(packagist): prepare package for Packagist availability#47faisalahammad wants to merge 1 commit intogravityforms:masterfrom
faisalahammad wants to merge 1 commit intogravityforms:masterfrom
Conversation
- Add wp-cli/wp-cli ^2.5 as a required dependency - Add keywords for Packagist discoverability - Add extra.commands to document provided WP-CLI commands - Update PHP minimum to >=5.6 (required by WP-CLI 2.x) - Fix SPDX license identifier (GPLv3 -> GPL-3.0-or-later) - Fix README.md case mismatch in .gitattributes - Add composer.lock to .gitattributes export-ignore - Add Installation section to README.md with Packagist method Fixes gravityforms#42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Summary
Prepares the
gravityforms/gravityformsclipackage for Packagist publication by adding the requiredwp-cli/wp-clidependency, improving metadata for discoverability, and documenting the Packagist installation method.📋 Issue Reference
Fixes #42
🔍 Problem Description
Current Behavior
The package declares
"type": "wp-cli-package"incomposer.jsonbut is not available on Packagist. Users who consume it via WPackagist get it installed as a WordPress plugin rather than a proper WP-CLI package. Installing viawp package install gravityforms/gravityformsclifails because Packagist cannot resolve the package.Expected Behavior
The package should be installable as a WP-CLI package directly from Packagist using:
Root Cause
The
composer.jsonis missing thewp-cli/wp-clidependency, which is the standard requirement for WP-CLI packages listed on Packagist. Without this dependency, Composer cannot properly resolve the package as a WP-CLI extension. Additionally, the package has never been submitted to Packagist.✨ Solution Overview
Approach Taken
Updated
composer.jsonwith the necessary dependency and metadata to make the package Packagist-ready:wp-cli/wp-cli ^2.5as a required dependencykeywordsfor search discoverabilityextra.commandsto document provided CLI commands>=5.6(required by WP-CLI 2.x).gitattributesfor clean distributionREADME.mdWhy This Approach
This follows the established pattern used by official WP-CLI packages (e.g.,
wp-cli/doctor-command,wp-cli/profile-command). Thewp-cli/wp-clidependency is essential for Packagist to properly classify and resolve the package. Theextra.commandsblock is the standard way WP-CLI packages declare their commands for documentation purposes.Alternatives Considered
wp-cli/wp-cli ^2.5requires PHP 5.6+, and PHP 5.3 has been EOL since 2014.🔧 Changes Made
Files Modified
composer.json— Added wp-cli dependency, keywords, commands metadata, fixed license.gitattributes— Fixed filename case, added composer.lock exclusionREADME.md— Added Installation section with Packagist methodDetailed Changes
1.
composer.jsonBefore:
{ "name": "gravityforms/gravityformscli", "description": "A set of WP-CLI commands to manage Gravity Forms.", "type": "wp-cli-package", "homepage": "https://github.com/gravityforms/gravityformscli", "support": { "issues": "https://gravityforms.com" }, "license": "GPLv3", "authors": [ { "name": "Rocketgenius", "email": "contact@rocketgenius.com", "homepage": "http://www.gravityforms.com" } ], "require": { "php": ">=5.3.29" }, "autoload": { "files": [ "cli.php" ] } }After:
{ "name": "gravityforms/gravityformscli", "description": "A set of WP-CLI commands to manage Gravity Forms.", "type": "wp-cli-package", "keywords": [ "wp-cli", "gravity-forms", "cli", "wordpress" ], "homepage": "https://github.com/gravityforms/gravityformscli", "support": { "issues": "https://gravityforms.com" }, "license": "GPL-3.0-or-later", "authors": [ { "name": "Rocketgenius", "email": "contact@rocketgenius.com", "homepage": "http://www.gravityforms.com" } ], "require": { "php": ">=5.6", "wp-cli/wp-cli": "^2.5" }, "autoload": { "files": [ "cli.php" ] }, "extra": { "commands": [ "gf", "gf form", "gf field", "gf entry", "gf license", "gf tool" ] } }Why This Works:
wp-cli/wp-cli ^2.5: This is the critical dependency that enables Packagist to properly resolve the package. When users runwp package install gravityforms/gravityformscli, Composer uses this dependency to verify compatibility with their WP-CLI installation.keywords: Packagist indexes these for search. Users searching for "wp-cli gravity forms" will find the package.extra.commands: The standard WP-CLI convention for declaring commands. Used by the WP-CLI package index andwp package browsefor command documentation.GPL-3.0-or-later: Fixes the Composer validation warning.GPLv3is not a valid SPDX identifier;GPL-3.0-or-lateris the correct format per the SPDX specification.>=5.6: Required sincewp-cli/wp-cli ^2.5itself requires PHP 5.6+. PHP 5.3 has been end-of-life since August 2014.Impact:
composer validatepasses with zero warningswp package install2.
.gitattributesBefore:
After:
Why This Works:
README.md(capital letters), but the export-ignore rule referencedreadme.md. Git is case-sensitive on Linux systems, so this rule was silently failing on CI/CD and Linux-based servers.composer.lockis excluded because it should not be distributed in library/package archives — only in application repositories.Impact:
README.mdcorrectly excluded from Composer archive downloadscomposer.lockexcluded from distribution archives3.
README.mdAdded an Installation section before "Getting started" with three installation methods:
Why This Works:
Once published on Packagist, users need clear documentation on the recommended installation method. The Packagist method is listed first as it installs the package correctly as a WP-CLI extension rather than a WordPress plugin.
Impact:
🧪 Testing Performed
Automated Validation
✅
composer.jsonpasses validation with zero errors and zero warnings.Manual Verification
gravityforms/directory is not included in any commits.gitattributescase matches actual filenamePost-Merge Verification (for maintainers)
After merging and submitting to Packagist:
📊 Performance Impact
N/A — This PR modifies only metadata and documentation files. No runtime PHP code is changed, so there is zero performance impact on the plugin's execution.
🔒 Security Considerations
composer.jsonmetadata,.gitattributesdistribution rules, andREADME.mddocumentation are modified.♿ Accessibility
🌍 Internationalization
✅ No breaking changes — Fully backward compatible.
wp package install https://github.com/gravityforms/gravityformscli.gitinstallation method still works📋 Post-Merge Steps for Maintainers
After merging this PR, two manual steps are needed:
https://github.com/gravityforms/gravityformscliv1.8tag: The codebase is at version 1.8 but the latest tag isv1.7. Creating a new tag ensures Packagist picks up the correct version:✅ PR Checklist
composer validatepasses cleanREADME.md).gitattributescorrected for distributionReady for Review ✨
This PR is ready for review and merge. Once merged, the maintainers can submit the package to Packagist and users will be able to install it with
wp package install gravityforms/gravityformscli.