medienbaecker / kirby-link-field

29 stars 2 forks source link

[Feature Request] Composer support #6

Closed bavarianbytes closed 5 years ago

bavarianbytes commented 5 years ago

Would be great to install your extension via composer.

https://getkirby.com/docs/guide/plugins/plugin-setup-composer

medienbaecker commented 5 years ago

I do have a composer.json, but personally don't use it. What doesn't work for you?

bavarianbytes commented 5 years ago

composer require medienbaecker/kirby-link-field didn't work as there is no composer support to install and load the plugin automatically in Kirby, is there?

medienbaecker commented 5 years ago

Maybe the "name": "medienbaecker/link" has to match the repository name… I'll try to fix it.

medienbaecker commented 5 years ago

I just adjusted the name, could you please try it again? Thanks a lot!

bavarianbytes commented 5 years ago

Doesn't work. Did you published it on Packagist? Furthermore your extension needs to support the Kirby Autoload mechanism (see the link i posted).

hdodov commented 5 years ago

Just found out about the plugin in time before I made exactly the same one. Composer support is a must, though. Composer is the recommended way to install Kirby from version 3 onwards and it's the best tool for managing dependencies. I use Composer and it's going to be pretty tough managing your plugin separately. Besides, other plugins can list your plugin as a dependency, allowing it to be used as part of a larger plugin.

Support for Composer and the Kirby install mechanism isn't hard. I did it and it was easy. kirby-easyvars is a plugin I made that way. You basically need to add:

"extra": {
  "installer-name": "{{ PLUGIN_NAME }}"
}

to your composer.json.

You should check the link that @bavarianbytes mentioned. It explains it all. And the upload process to Packagist (Composer's repository) literally takes less than a minute. Once you link the package to your repo, you don't even need to care about Packagist. It will automatically crawl the repo and upload new versions. Please, add it when you can.

medienbaecker commented 5 years ago

Thanks @hdodov for your help!

I just added the three lines to the composer.json. Tbh I still haven't found the part where the installer-name stuff is explained in the docs.

But I hope it works now.

medienbaecker commented 5 years ago

image

After I added a 1.0 release and published the plugin on packagist, I just successfully installed the plugin via composer. I had to add a "minimum-stability" setting to my composer.json — is this normal?

hdodov commented 5 years ago

It's not normal if you want to publish a stable release, which you do. Check how to publish a stable release here.

macx commented 5 years ago

Please publish it as a stable version!

I get this: Could not find a version of package medienbaecker/kirby-link-field matching your minimum-stability (beta)

medienbaecker commented 5 years ago

@hdodov @macx Sorry for the hassle. Packagist didn't like my version 1.0 so I added a 1.0.0 and now it works! 🎊