Install via composer as library

Support General Install via composer as libraryResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #20285
    Guillaume DelageGuillaume Delage
    Participant

    Hello,

    I'm following https://docs.metabox.io/composer/ to install metabox via composer (and that's very nice!) but I hoped that I could use metabox as a library like in the link example.

    Instead of being installed in vendo/wpmetabox/meta-box like one would expect, it is installed as a plugin.

    Am I doing something wrong, or metabox is only meant to be installed as a plugin?
    I also want to install (paid) metabox plugins, so my question extends to those.

    I'm using bedrock, I don't know if it matters.

    Thank you

    #20288
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please watch this video to install the plugin Meta Box and free extensions via composer as libraries inside a custom plugin.

    Fore premium extensions, please follow this documentation https://docs.metabox.io/extensions/composer/. You can also download the file composer.json in here to get full extensions.

    #20320
    Guillaume DelageGuillaume Delage
    Participant

    Thank you for your answer.

    I followed the documentation link you provided but I can't seems to make it work as a library for my theme (not for a custom plugin).

    Is there some resource or example of doing this?

    #20326
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please see my screen record https://www.loom.com/share/cc9c10981c964dcaaf61aa597dda9cc9.

    I've created a file composer.json in a theme folder, run the command composer install then require the file vendor/autoload.php in the file functions.php. It works as well as a library.

    {
      "repositories":[
        {
          "type": "composer",
          "url": "https://wpackagist.org"
        }
      ],
      "require": {
        "wpackagist-plugin/meta-box": "dev-trunk"
      },
      "extra": {
        "installer-paths": {
          "vendor/meta-box/meta-box": ["wpackagist-plugin/meta-box"]
        }
      },
      "autoload": {
        "files": [
          "vendor/meta-box/meta-box/meta-box.php"
        ]
      }
    }
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.