satis icon indicating copy to clipboard operation
satis copied to clipboard

Local development without a webserver

Open tcdaly opened this issue 4 weeks ago • 7 comments

Is it possible to create a Satis repository on a local filesystem that is accessible to projects on the same filesystem, without a webserver or HTTP? I'm finding that this line in satis.json produces the error homepage : Invalid URL format:

"homepage": "file:///mnt/daladi/dev/tests/php-composer/composer-test-repo/"

tcdaly avatar Dec 01 '25 23:12 tcdaly

I am honestly not sure. Since Satis sort of functions as a Packagist alternative, I think composer also expects it to be web accessible? It's not really like a git repository for a single package which can be accessed locally. @stof Or am I wrong; do you perhaps have better insight into this?

alcohol avatar Dec 02 '25 08:12 alcohol

Hmm a quick peek at the Composer repository class would suggest I am wrong indeed;

https://github.com/composer/composer/blob/main/src/Composer/Repository/ComposerRepository.php#L144

alcohol avatar Dec 02 '25 08:12 alcohol

Just out of curiosity, have you tried file:// instead of file:/// ?

alcohol avatar Dec 02 '25 08:12 alcohol

The issue is that the JSON schema requires homepage to be a URL.

Looking at the regex used by the PHP library used by composer to validate the uri format, it does not seem to accept URIs with an empty host name: https://github.com/jsonrainbow/json-schema/blob/3c25fe750c1599716ef26aa997f7c026cee8c4b7/src/JsonSchema/Tool/Validator/UriValidator.php#L11-L20 And that is the case for a file URL.

stof avatar Dec 02 '25 10:12 stof

Agreed, in other words the URI validator doesn't support URLs with the file:// scheme. It could be easily fixed by adding a ? after the hostname group in the regexp, making it optional. I'm not sure if this is a bug as such, or a deliberate design decision. Even if this was changed, I don't know if the rest of the software would support local filesystem access.

tcdaly avatar Dec 02 '25 11:12 tcdaly

Just out of curiosity, have you tried file:// instead of file:/// ?

It looks like this would result in the validation passing, but it would be a hack since strictly there should be the 3 slashes - the third slash being the start of the filesystem path

tcdaly avatar Dec 02 '25 11:12 tcdaly

Oh boy https://en.wikipedia.org/wiki/File_URI_scheme

Honestly not sure if this should be considered a "bug" in the library used; or if this warrants a different approach to validating the homepage value.

alcohol avatar Dec 04 '25 08:12 alcohol

https://github.com/jsonrainbow/json-schema/pull/858 I think this resolves the issue described here; so I think we can close this issue if it gets merged, released and picked up by composer/composer.

alcohol avatar Dec 15 '25 09:12 alcohol