php / pie

The PHP Installer for Extensions
BSD 3-Clause "New" or "Revised" License
666 stars 19 forks source link

Provide pre-built DLLs from Private Packagist #110

Open macintoshplus opened 1 week ago

macintoshplus commented 1 week ago

Some companies or state organizations do not allow the servers or the developer's computer to access the Internet. Others have a private PHP extension. I use the Satis term to speak of the private packagist.

I try to understand how PIE works with a private composer repository and how to get the DLL to install it. Without reading the code ;-)

I have tried with Satis and xdebug. The installation has noway.

Composer repository and satis generated files do not contain the PHP extension configuration to build or get the DLL.

For each package information provided by Satis, this is the minimal information:

{
    "name": "smarty/smarty",
    "version": "3.1.7",
    "dist": {
        "url": "https://www.smarty.net/files/Smarty-3.1.7.zip",
        "type": "zip"
    }
}

This information is minimal for PHP library. But for PHP extension, some other information is needed: DLL download information, and compilation options...

I have this idea of JSON structure for an extension package

{
    "name": "xdebug/xdebug",
    "version": "3.1.7",
    "sources": {
        "url": "https://xdebug.org/files/xdebug-3.1.7.zip",
        "type": "zip"
        "reference": "tags/3.1.7"
    }
    "dist": {
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-ts-vs17-x86_64.zip",
        "type": "zip"
    },{
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-ts-vs17-x86.zip",
        "type": "zip"
    },{
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-nts-vs17-x86_64.zip",
        "type": "zip"
    },{
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-nts-vs17-x86.zip",
        "type": "zip"
    }
}

The source archive contains the composer.json file with the build options and other information. However, no information about the DLLs.

With the public packagist, PIE gets the DLL from the Release Asset and searches the right archive corresponding with the name template (see doc).

How to download DLL from Satis or another private composer repository?

macintoshplus commented 5 days ago

@Seldaek, this change has an impact on the composer?

Seldaek commented 5 days ago

Yes this would not be doable as you describe just in pie I suppose, unless pie stores/retrieves this stuff in the extra key.

macintoshplus commented 5 days ago

Yes this would not be doable as you describe just in pie I suppose, unless pie stores/retrieves this stuff in the extra key.

Okay, this schema is possible:

{
    "name": "xdebug/xdebug",
    "version": "3.1.7",
    "dist": {
        "url": "https://xdebug.org/files/xdebug-3.1.7.zip",
        "type": "zip"
    }
   "extra": {
        "windows-dist": {
            "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-ts-vs17-x86_64.zip",
            "type": "zip"
        },{
            "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-ts-vs17-x86.zip",
            "type": "zip"
        },{
            "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-nts-vs17-x86_64.zip",
            "type": "zip"
        },{
            "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-nts-vs17-x86.zip",
            "type": "zip"
        }
    }
}
asgrim commented 5 days ago

I'm starting to understand what you're asking for now. You are asking for another way of downloading pre-built DLLs (your use case being that you cannot use public internet).

At the moment, the only supported way PIE fetches DLLs is by downloading from the release assets on a GH release: https://github.com/php/pie/blob/main/docs/extension-maintainers.md#windows-support

We can evaluate in the future other ways of downloading prebuilt DLLs such as this, but this isn't something I'll be able to look at just yet.

macintoshplus commented 4 days ago

This feature can be used by the maintainer in the composer.json found in the version package. In this case, the Packagist must copy the information.

Now you use the GitHub release feature, but some other SVC systems exist and some other source code hosting exists (Zoho, Bitbucket, GitLab...).

tillkruss commented 4 days ago

We managed to build a private extension by wrapping it inside a fake extension, would be nice to see 1st party support for this.

https://github.com/yatsukhnenko/ext-yaler