Installing a plugin with composer for newbies

Hi all,

new to Kirby, I am quite excited how smooth it works for someone with not so much PHP knowledge.
I was a little disappointed when I found out that K3 doesn’t support HTML-CSS-JS minification out of the box.
Good luck that I found the plugin https://github.com/afbora/kirby-minify-html which does at least one part of this job.
Bad luck that it seems to require an installation with composer because I’m completely new to that. Is there an easy way to learn how to deal with this plugin installation? Manually putting kirby-minify-html-master into site/plugins shows no result. Additionally, how to find out which plugins are currently installed?

Sorry for my nOOb questions, is there any help for me? Thanks in advance,
Achim

If you download the zip file, you shouldn’t need composer to install the plugin.

Another alternative to composer is installing as a git submodule.

For installation with composer, you need to install composer on your computer. Once that is done, its only a matter of executing this one line from the readme.

composer require afbora/kirby-minify-html

You might also find this useful:

And welcome to Kirby!

Thanks for your welcome and the quick reply.

I have put the whole folder in the plugins directory, but …

how to find out which plugins are currently installed and running?

I also tried to install composer on my Mac but it looks like that I was not successful:
-bash: composer: command not found

Later, I’ll check out the page that you recommended (Kirby meets Composer | Kirby CMS)

There are two ways to install composer, locally and globally. If you install globally, you also have to put it into your path.

If you do a dump($kirby->plugins()) in a template, you should get a list of installed plugins. (https://getkirby.com/docs/reference/objects/kirby/plugins).

@aschlemmer:

May be you have to add something in the config file?
I cannot find hints to this in the readme of the plugin.
I never used this plugin, may be the author, @ahmetbora I think, will answer…

ok, I feel this is too much for me …

this works nicely - I get (except):

Array

(
[afbora/kirby-minify-html] => Kirby\Cms\Plugin Object
(
[extends:protected] => Array
(
[options] => Array
(
[enabled] => 1
[options] => Array
(
)

                    )

Alas, minification is working. Thanks to all answers!

yes, I included in the config.php:

return [
    'afbora.kirby-minify-html.enabled' => true,
    'afbora.kirby-minify-html.options' => [
        'doOptimizeViaHtmlDomParser' => true, // set true/false or remove line to default
        'doRemoveSpacesBetweenTags'  => false // set true/false or remove line to default
    ],
];

But you can only have ONE return statement in this file https://getkirby.com/docs/guide/configuration#the-config-php
!
I don’t know, if you have only (“included”) one…