vinkla / wordplate

A boilerplate for WordPress, built with Composer and designed with sensible defaults.
2.12k stars 155 forks source link

Add paid/private/premium plugin to wordplate #209

Closed hocine87 closed 6 years ago

hocine87 commented 6 years ago

Hi,

I'm trying to add a private wordpress plugin and paid plugin, but can't find a way to add a custom repo in the installer-paths arrays with packagist etc.

Do you have an idea or official procedure ?

Thanks!

vinkla commented 6 years ago

There is no official WordPlate way of doing this. Instead we use Composer together with their installers package. Here is an example of how you can install the commercial* version of ACF:

"repositories": [
    {
        "type": "package",
        "package": {
            "name": "wpackagist-plugin/advanced-custom-fields-pro",
            "type": "wordpress-plugin",
            "version": "5.6.10",
            "dist": {
                "url": "https://connect.advancedcustomfields.com/index.php?v=5.6.10&p=pro&a=download&k=your-acf-key",
                "type": "zip"
            }
        }
    }
]

Then add it to the require object and it will be installed to the plugins directory.

* This requires an ACF license key.

hocine87 commented 6 years ago

Ok, but now for activate, i did a composer require my-plugin/my-plugin-pro and composer update and i can't find the plugin in the extensions list in wordpress

vinkla commented 6 years ago

Hmm, paste your composer.json file.

hocine87 commented 6 years ago

I remove my key of pro version in the URL to share here

{
    "name": "wordplate/wordplate",
    "description": "A modern WordPress stack built with Composer",
    "keywords": ["wordplate", "wordpress", "boilerplate", "plate"],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "wc-vendors/wc-vendors-pro": "^1.5",
        "wordplate/framework": "^6.3",
        "wordplate/mail": "^4.0",
        "wordplate/plate": "^4.0",
        "wpackagist-plugin/disable-embeds": "^1.3",
        "wpackagist-plugin/disable-emojis": "^1.7",
        "wpackagist-plugin/email-log": "^2.2",
        "wpackagist-plugin/hide-updates": "^1.0",
        "wpackagist-plugin/mangopay-woocommerce": "^2.6",
        "wpackagist-plugin/wc-vendors": "^2.0",
        "wpackagist-plugin/woocommerce": "^3.4"
    },
    "repositories": [{
            "type": "composer",
            "url": "https://wpackagist.org"
        },
        {
            "type": "package",
            "package": {
                "name": "wc-vendors/wc-vendors-pro",
                "type": "wordpress-plugin",
                "version": "1.5.4",
                "dist": {
                    "url": "https://www.wcvendors.com/?download_file=79091&order=XXXXXXXX&email=XXXXXXXXX&key=XXXXXXXX",
                    "type": "zip"
                }
            }
        }
    ],
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ]
    },
    "extra": {
        "installer-paths": {
            "public/mu-plugins/{$name}": [
                "type:wordpress-muplugin",
                "wordplate/plate",
                "wpackagist-plugin/disable-emojis",
                "wpackagist-plugin/disable-embeds",
                "wpackagist-plugin/email-log",
                "wpackagist-plugin/hide-updates"
            ],
            "public/plugins/{$name}": ["type:wordpress-plugin"],
            "public/themes/{$name}": ["type:wordpress-theme"]
        },
        "wordpress-install-dir": "public/wordpress"
    },
    "config": {
        "preferred-install": "dist",
        "optimize-autoloader": true,
        "sort-packages": true
    }
}
vinkla commented 6 years ago

The composer.json file looks good to me. Not sure what your issue is.

hocine87 commented 6 years ago

In VSCode i have this : Unable to load schema from 'https://getcomposer.org/schema.json': Unable to connect to https://getcomposer.org/schema.json. Error: getaddrinfo ENOTFOUND getcomposer.org getcomposer.org:443

So perhaps this the problem ?

hocine87 commented 6 years ago

So fixed, The problem is the URL where the composer ZIP creates a folder with the plugin folder. And he create a folder in folder like "my-plugin-pro/my-plugin-pro/"