Skip to content

[PHP] Allow for private Composer repository in documentation #3836

Closed

Description

@dkarlovi
Description

When constructing a PHP client, README.md will include this snippet to add to composer.json:

"repositories": [
    {
        "type": "git",
        "url": "https://github.com/<composerVendorName>/<composerProjectName>.git"
    }
]

As we're generating a private API client with a proper private Composer repo (Satis), usage of our package should include:

"repositories": [
    {
        "type": "composer",
        "url": "https://package.example.com"
    }
]
Swagger-codegen version

@e6049d6d30822c35a13608667637591f6536ad41

Swagger declaration file content or url

config.json

Command line used for generation
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l php -o . -c ./config.json
Steps to reproduce

There's no way to generate a PHP client without it happening, I don't see a way to provide configuration regarding this. My config.json:

{
    "invokerPackage": "Example",
    "modelPackage": "Example\\Model",
    "apiPackage": "Example\\Api",
    "packagePath": ".",
    "srcBasePath": "src",
    "composerProjectName": "example-php-sdk",
    "composerVendorName": "private"
}

Generated with

swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l php -o . -c ./config.json

Open README.md

Suggest a Fix

Allow for specifying Composer package destination.

Activity

  1. wing328 commented on Sep 20, 2016

    @wing328
    Contributor

    @dkarlovi thanks for the feedback, which sounds reasonable to me.

    May I know if you've time to contribute the enhancement to use CLI option (e.g. composerRepositoriesURL) to specify the URL?

  2. added this to the v2.2.2 milestone on Sep 20, 2016
  3. dkarlovi commented on Sep 20, 2016

    @dkarlovi
    ContributorAuthor

    @wing328 I might, but as I don't have professional experience with Java (only did assignments in college), would need a second pair of eyes. Guess a WiP PR would be fine?

    I have other PHP client-related ideas too so it might be a good start.

  4. wing328 commented on Sep 21, 2016

    @wing328
    Contributor

    @dkarlovi #977 may serve as a good reference.

  5. modified the milestones: Future, v2.2.2 on Feb 15, 2017
  6. wing328 commented on Feb 15, 2017

    @wing328
    Contributor

    FYI. Another way to do it is to customized the template composer.mustache and use it with the -t option.

  7. baartosz commented on Mar 10, 2017

    @baartosz
    Contributor

    Cli option does not looks like good solution after considering how complex structure of repositories config can be: https://getcomposer.org/doc/04-schema.md#repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions