Add local Composer package setup for shared JWT logic with iterative development workflow #2
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.
Overview
This PR implements a professional local Composer package structure for sharing JWT authentication logic across multiple WordPress plugins. The implementation demonstrates modern PHP package management best practices with support for iterative development, production builds, and future repository extraction.
What's New
📦 Shared Package:
jwt-auth-coreA reusable JWT library package containing:
MyOrg\JWTAuthCorenamespace)🔌 Example Plugins
Two WordPress plugins demonstrating the shared package usage:
wp-jwt-login - JWT authentication plugin
wp-oauth-login - OAuth 2.0 authentication plugin
🔄 Iterative Development Workflow
The setup uses Composer's
pathrepository type with symlinks, enabling:jwt-auth-core/src/TokenManager.phpand see changes instantly in both plugins📚 Comprehensive Documentation
Created 8 documentation files (53KB total) covering:
🎯 Key Features
Technical Implementation
Composer Configuration
Both plugins use path repositories pointing to the shared package:
{ "repositories": [ { "type": "path", "url": "../jwt-auth-core" } ], "require": { "myorg/jwt-auth-core": "@dev" } }This creates symlinks (not copies) in
vendor/myorg/jwt-auth-core, enabling iterative development.Directory Structure
Testing
All automated tests pass ✅
The test script verifies:
Quick Start
Future Migration Path
When ready to extract
jwt-auth-coreto its own repository:composer.jsonto use VCS repositorycomposer update myorg/jwt-auth-coreDetailed migration instructions are in COMPOSER-SETUP.md.
Production Builds
For WordPress.org releases:
Important: The
vendor/directory must be included in WordPress.org distributions.Documentation
Start with README-COMPOSER.md for complete navigation and quick reference guides.
Benefits
This implementation provides a production-ready foundation for sharing code between WordPress plugins using modern PHP package management standards.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2/usr/bin/php8.3 -n -c /tmp/4MhFU4 /usr/bin/composer install(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.