Composer Install the plainkit in a custom folder

Hello!
I followed the guide about installing Kirby in a custom folder with Composer.
All my config files are in the root and all the things who will be uploaded are in the /web directory.

So I created a composer.json in the root of my project which will install the plaintext in /web by running composer install:

{
  "require": {
    "getkirby/plainkit": "^3.0"
  },
  "config": {
    "optimize-autoloader": true
  },
  "extra": {
    "kirby-cms-path": "web"
  }
}

But all I have is the Kirby core only, in the /web directory. I expected to have the plainkit with all its files in /web. It’s a bit confusing :thinking:.

you can use composer create-project with the plainkit. that logic is something like a git clone.

as far as i understand the code composer installer package of kirby its only changing/renaming the vendor folder. that has nothing to do with the complete plainkit repo.
edited: it should be used with getkirby/cms not with the other ones.

but @lukasbestle should be able to verify that.

Hi @bnomei

I tried the create-project solution at first but I wasn’t happy with it because of the location of the composer.json file. I like having it at root with all other config files I have for the project. Also, it simpler in CLI to avoid running cd everytime.

The Plainkit is just a template for your own project. You should not require it with Composer but instead install it one time (with create-project) and then modify it according to your needs.

If you’d like to have the composer.json outside of the web root, you can configure the installation like this:

{
  "require": {
    "getkirby/cms": "^3.0"
  },
  "config": {
    "optimize-autoloader": true
  },
  "extra": {
    "kirby-cms-path": "web/kirby"
  }
}

@lukasbestle Thanks for your reply.

So if i understand,

  1. I run composer create-project getkirby/plainkit web
  2. Then I create a composer.json at the root containing your example
  3. And I run composer install

In case, I tried and it look like it’s ok :stuck_out_tongue:
I also added "kirby-plugin-path": "web/site/plugins" for the plugins installation.

{
  "require": {
    "getkirby/cms": "^3.0"
  },
  "config": {
    "optimize-autoloader": true
  },
  "extra": {
    "kirby-cms-path": "web/kirby",
    "kirby-plugin-path": "web/site/plugins"
  }
}

with composer i usually use the “/public setup” so all config files can stay at root. like here

Your /public is my /web :smiley:

Looks good to me. :slight_smile: