libretime / client

API clients for LibreTime (experimental)
3 stars 3 forks source link

PHP client - Package in sub folder triggers a composer installation error #57

Open csmMike opened 4 months ago

csmMike commented 4 months ago

When attempting to install the PHP client using Composer, an error is encountered indicating that no packages can be found in the repo, despite adding the repo URL to the composer.json file, as per the README instructions, and running composer install, the same error persists.

The PHP client package is located in a subfolder named php-client, but Composer does not seem to support packages in subfolders, limiting the installation process.

How could it be solved?

csmMike commented 4 months ago

I circumvented the problem by generating the api using openapi generator based on the schema.yml file. Then I pushed the composer package into a repo of mine. The installation went fine, there was a bit of trickery with compose.json, but that's on my ignorance of composer. I managed to test the FilesApi endpoint, filesList(), and everything went smoothly.

As of now, I will update the package, by regenerating the apis, each time the schema.yml file in this repo changes. A bit of a hack, but at least I can start testing out things. :)

paddatrapper commented 4 months ago

It would seem we need to host the PHP library in its own repo for composer to see it properly. It shouldn't be impossible, but does need some reworking of the generation code

csmMike commented 3 months ago

This action could be used just after the 'test' step in the php-client.yml workflow It can even be remade easily I think, but this action seems to be quite popular To proceed with this solution we need the php-client and a private token to have the correct permission Additionally, the php-client/README.md should reflect the new repo url to ease the composer installation

Maybe I can try it out first to save you all some time? I think I could temporarily fork this repo, make the steps I described above and see what happens