Comments (7)
I was thinking about this a couple of weeks ago. Specifically, I was wondering how one would also support non-EDD APIs. The following is what I came up with, it's clunky but a practical solution:
GRAVITY_FORMS_KEY='MyLicenseKey'
POLYLANG_PRO_KEY='MyEddLicenseKey'
POLYLANG_PRO_URL='MyEddRegisteredUrl'
POLYLANG_PRO_USERNAME='MyPolylangUsername'
POLYLANG_PRO_PASSWORD='MyPolylangPassword'
[
{
"type": "package",
"package": {
"name": "wpsyntex/polylang-pro",
"version": "2.8.2",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
"url": "https://www.polylang.pro/?edd_action=get_version&item_name=Polylang+Pro&license={%POLYLANG_PRO_KEY}&url={%POLYLANG_PRO_URL}&version={%VERSION}"
},
"extra": {
"private-composer-installer": {
"http": {
"method": "POST",
"username": "{%POLYLANG_PRO_USERNAME}",
"password": "{%POLYLANG_PRO_PASSWORD}",
"response-type": "json",
"download-url-key": "download_link"
}
}
},
"require": {
"composer/installers": "^1.4",
"ffraenz/private-composer-installer": "^5.0"
}
}
},
{
"type": "package",
"package": {
"name": "gravityforms/gravityforms",
"version": "2.4.20",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
"url": "https://www.gravityhelp.com/wp-content/plugins/gravitymanager/api.php?op=get_plugin&slug=gravityforms&key={%GRAVITY_FORMS_KEY}&version={%VERSION}"
},
"extra": {
"private-composer-installer": {
"http": {
"method": "POST",
"response-type": "json",
"download-url-key": "download_url_latest"
}
}
},
"require": {
"composer/installers": "^1.4",
"ffraenz/private-composer-installer": "^5.0"
}
}
}
]
Inspired by Composer's custom header authentication
from private-composer-installer.
@ffraenz What do you think about supporting plugins distributed with EDD?
from private-composer-installer.
These are the steps.
- Get plugin data from
{%EDD_SELLER_WEBSITE_URL}?edd_action=get_version&item_id={%EDD_ITEM_ID}&license={%EDD_LICENSE_KEY}&url={%EDD_REGISTERED_WEBSITE_URL}
as JSON - Take 'package' element from the JSON
- Download plugin ZIP from that URL
Seems possible to me.
from private-composer-installer.
@ffraenz It would be nice to make private-composer-installer extendable and develop these features in a separate plugin.
from private-composer-installer.
I think both approaches are very interesting.
The configuration array I introduced in #25 may be exploited to offer a location for custom environment loaders that can be described in a modular way similar to what you suggested above. Tough, we'd need to design it in a way that makes this feature easily accessible. An alternative would be build in support for certain vendors.
from private-composer-installer.
build in support for certain vendors.
Instead we can provide a mechanism to get the download URL by code e.g. from an API: gravityforms, polylang, envato
Some kind of hook maybe ...
from private-composer-installer.
I don't think it's should be make extensible because many users won't accept pulling many levels of dependencies with all the gotchas there is wrt of composer install/update
sequence (see, eg, merge-plugin).
But it should be rather support most known-cases and optionally be generic enough (URL + payload + placeholder?) to manage custom cases.
About the generic handler proposed by @mcaskill it's probably the way to go:
- URL
- method
- content
- payload's key
But to be truly generic you may miss:
- authentication (for Basic auth)
- content type (json, form-urlencoded, ...)
- headers (for arbitrary headers)
- user-agent (in case this is needed)
- and possibly whether redirects are followed or not.
- and the fact that the payload may be in XML, YAML, ... or have decode a given key (gzip, base64, ...) or the object key be nested.
That's why implementing known providers (one provider being < 10 LoC in a PHP method) is probably quicker, simpler, easier to configure and would serve the vast majority of users turning into this composer plugin.
Eg: Instead of type: package
, is it possible to register another repository type
(like gravityforms
, edd
, ffraenz/private:gravityforms
, name it) so that the overall user's configuration is made even simpler?
from private-composer-installer.
Related Issues (20)
- Install issue with roots.io Bedrook HOT 3
- Incompatile with prestissimo plugin HOT 8
- Support for Composer 2 HOT 3
- Support placeholder in other part than dist URL HOT 3
- Can you place the .env file in a directory above `composer.json`? HOT 3
- Type content/mu-plugin HOT 1
- Update dependency vlucas/phpdotenv to v5 HOT 2
- Allowed memory exhausted when installing v5 HOT 3
- Fatal error: Uncaught TypeError: Argument 2 passed to FFraenz\PrivateComposerInstaller\Plugin::fulfillVersionPlaceholder() HOT 2
- Fail installing ACF when running `composer update` after updating to Composer 2 HOT 6
- Empty ACF package folder in vendor/ HOT 8
- Class 'FFraenz\PrivateComposerInstaller\Environment\LoaderFactory' not found HOT 17
- "Could not find package" (Packagist conflict?) HOT 7
- Compatibility with GitHub Actions? HOT 6
- WPML installation stopped working? HOT 9
- Version constraint for Composer 1 does not allow ACF 5.10.x to update HOT 3
- Support for Yith plugins HOT 6
- How to download Divi theme HOT 2
- Remove ACF Pro from examples now that they support native Composer integration? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from private-composer-installer.