Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install cockpit as a composer dependency #261

Closed
youknowriad opened this issue Jan 29, 2015 · 17 comments
Closed

Install cockpit as a composer dependency #261

youknowriad opened this issue Jan 29, 2015 · 17 comments

Comments

@youknowriad
Copy link

Hi, Is there a way yo install cockpit as a composer dependency and have the custom config outside the vendor folder.

Thanks a lot

@aheinze
Copy link
Member

aheinze commented Jan 31, 2015

hi,

the only possible way I can think of are composer scripts: https://getcomposer.org/doc/articles/scripts.md

@youknowriad
Copy link
Author

Hi,

I think if cockpit is intended to be for developers, it should be easy to install and update with developers tools (composer pour PHP). I think your point (am I wrong) is to make easy to use, juste copy/paste and launch a webserver, but for many developpers like, we want to be able to add the cockpit code to .gitignore and we want it to be outside the public path, update it easily with composer and custom some paths (cache, storage).

I've tried some things, override some consts and symlink assets, but I've not the required knowledge of how the CSM is organised to make this work. May be you should consider having two install methods ? one with composer with the ability to custom paths and one copy/paste method.

Thanks

@omnilight
Copy link
Contributor

I agree with @youknowriad , you should provide way to customize paths for cockpit out of the box.

For example currently I see one problem: you define bootstrap.php in your composer.json and this makes it impossible to change any constants in this file after composer load.

Maybe you should exclude this file from autoloading, or at least maybe create separate repository that can be used for composer dependecies, and another repository for installing cockpit as standalone application

@piotr-cz
Copy link
Contributor

piotr-cz commented Apr 3, 2015

I've got idea.
Maybe it would be possible trough Composer Installers.

If there would a package type publicFolder with destination of public subfolder (public, web or public_html),
and Cockpit's composer.json would look like:

"name": "aheinze/cockpit",
"type": "publicFolder",
"extra": {
    "installer-name": "cockpit"
}

then using composer it should get installed to public/cockpit folder.

@youknowriad
Copy link
Author

@piotr-cz Not a bad idea

@piotr-cz
Copy link
Contributor

piotr-cz commented Apr 8, 2015

Maybe cleaner way is to register cockpit installer type for composer.
Additionally it would open possibility to install modules using composer:

Cockpit application
destination: ./public/cockpit

{
  "name": "aheinze/cockpit",
  "type": "cockpit-core",
  "extra": {
    "installer-name": "cockpit"
  }
}

Example module
destination: ./public/cockpit/modules/addons

{
  "name": "verdorName/FooBar",
  "type": "cockpit-module",
  "extra": {
    "installer-name": "FooBar"
  }
}

Downside is that the public folder should be pre-set (hardcoded) in the installer type.
Maybe it's possible overwrite it with a CLI parameter, but haven't investigated further.

If you are wondering, why there is an extra.installer-name key, it makes the target install directly into such subfolder instead of default composer scheme vendor/productName. But it may not be necessary (See JoomlaInstaller.php)

@aheinze
Copy link
Member

aheinze commented Apr 10, 2015

@piotr-cz awesome

@piotr-cz
Copy link
Contributor

I vote for public name as it seems most explicit to me. By inspecting Base installer.php file
maybe it's possible to change it in root composer.json file with handling something like extra.publicPath.

@aheinze
Copy link
Member

aheinze commented Apr 10, 2015

do I need to change anything in cockpits composer.json?

@piotr-cz
Copy link
Contributor

I'm not sure I understood correctly the purpose of installer-name but IMHO it doesn't make sense to play with it without above steps anyway.

BTW: All of this is theory, I haven't tried it out.

@piotr-cz
Copy link
Contributor

Another option would be to create an installer similar to Laravel installer (GitHub repo, Docs) or Lumen installer (GitHub repo, Docs).

@jbrooksuk
Copy link

This would be idea for us, since we build our websites with Laravel, we just want to use the helper methods collection or region etc within our existing code. We handle routing etc, but want to use the helpers only.

@piotr-cz
Copy link
Contributor

One more and maybe most easiest option is to treat Cockpit like a frontend component (jQuery/ Bootstrap) using Component Installer for Composer

So in projects composer.json file we'd define

{
    "require": {
        "components/cockpit": "~0.13"
    }
}

@royduin
Copy link

royduin commented Oct 21, 2015

Any updates on this one? Maybe an idea to do it like Bedrock does for Wordpress? See:

@royduin
Copy link

royduin commented Oct 23, 2015

Relevant to this issue: mnsami/composer-custom-directory-installer#11

@piotr-cz
Copy link
Contributor

I've added support for Cockpit modules as composer installers.
New version that includes aforementioned commit It's not released yet

See composer/installers#284 for details.

@omzy
Copy link

omzy commented Jul 3, 2018

So, what is the process for installing Cockpit as a Composer dependency? For example I want to use Cockpit as a CMS for Laravel, since it is a 3rd party package it should be installed to the vendor folder, and not manually copied to the public folder. The Cockpit storage folder can/should exist in the public folder however.

What is the correct way of doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants