Closed SamTyurenkov closed 10 months ago
@SamTyurenkov can you point to another wordpress plugin I can use as reference with such a file?
@mattbucci i think you can check any enterprise level plugin's github for example. Here is yoast for example: https://github.com/Yoast/wordpress-seo/blob/trunk/composer.json
Basically, you can start with as simple as filling the json with name, description, license, type. And see if you can pull it via composer from git source url.
Maybe there are some additional required properties, Im not sure.
I come from a laravel background so I'm familiar with the tooling, but jeez that's a lot of boilerplate. We run into a lot of issues with multiple wordpress plugins also using composer and pulling down different versions of packages (for instance plugins which use guzzle instead of using wordpress's built in tooling)
I purposefully didn't do this with postgresql for wordpress when it came to running tests because I don't think the composer ecosystem necessarily plays well with wordpress.
I could potentially add a composer.json file with some auto loading capabilities within the pg4wp folder, but at this time I'm hesitant.
For my own deployments I rehost just the pg4wp folder and add it as a submodule to my wordpress monorepo which contains the wordpress install, plugins and themes
@mattbucci I think these issues are easily solvable. Not sure what you mean exactly, but many projects dont pull dependencies when using plugin by end user, dependencies only pulled for development in many cases, so end user shouldn't encounter conflicts.
In your case you can also use 0 dependencies if you dont need them at all.
You also dont need to think about autoloading, this is either not needed at all if you pull a project into plugins folder and plugin will be loaded the usual wordpress way.
I recommend you to take a look at Bedrock boilerplate https://roots.io/bedrock/
This is one of the examples where wordpress core and plugins can be installed/updated via composer.
It seems like it would be more straightforward to just list this package via the WP registry per the following docs https://roots.io/bedrock/docs/composer/
This is captured in the following issue: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/issues/34
Once uploaded to wordpress plugins directory this is covered by https://wpackagist.org/
a bedrock user would simply do something like
composer require wpackagist-plugin/postgresql-for-wordpress
Until https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/issues/32 is resolved you can't install this plugin like a normal plugin anyway because you need to create the db.php file in wp-content.
@mattbucci
This is only true if you intend to publish your code to official Wordpress repository via SVN control system. In this case it will appear in wpackagist list.
If not, it is installable directly from github via composer, if composer.json file is present.
So as I asked in first message, would you please add the composer.json file to the repository. So it is directly available for download from github via composer.
I don't think I will add this composer.json.
As mentioned previously I do intend to publish it on the official WordPress repository via svn.
Until then you can follow the guidance here: https://roots.io/bedrock/docs/private-or-commercial-wordpress-plugins-as-composer-dependencies/
Would be nice to be able to use composer to download repository.
Would you mind adding composer.json to the structure?