rugk / threema-msgapi-sdk-php

Gateway MsgApi SDK - PHP
https://rugk.github.io/threema-msgapi-sdk-php/
Other
12 stars 5 forks source link

Howto require official branch #55

Closed selamhabibi closed 6 years ago

selamhabibi commented 6 years ago

I would like to use the mirror of the Official Threema PHP SDK for my project. Unfortunately, I'm not able to reference the corresponding branch with the composer.

Here is my call: => composer require rugk / threema-msgapi-sdk-php:dev-official

I get the following error message:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package rugk / threema-msgapi-sdk-php dev-official exists as rugk / threema-msgapi-sdk-php [1.2.0, dev-master, v1.1.7] but these are rejected by your constraint.

I do not understand the error message. Is the composer command not correct?

rugk commented 6 years ago

I'd say better ask the composer devs. Maybe it happens, because I do not officially publish the official branch. (See the composer website)

In any case why not either just use master or if you want the official version, just download the zip…

medienverbinder commented 6 years ago

You can add your "own" package to composer.json file:

...
"repositories": [
{
  "type": "package",
  "package": {
    "name": "threema/threema-msgapi-sdk-php",
    "version": "1.1.7",
    "dist": {
      "url": "https://gateway.threema.ch/sdk/threema-msgapi-sdk-php-1.1.7.zip",
      "type": "zip"
    },
}
...

Now you can call "composer require threema/threema-msgapi-sdk-php" to add the official threema php sdk (from the given url in the composer.json file) to your project.

Of course you can also add a

...
"require": {
        "threema/threema-msgapi-sdk-php": "1.1.7"
    }

...

to the composer.json file and add the threema php sdk via "composer install" to your vendor directory.

Composer packages and repositories

selamhabibi commented 6 years ago

Thank you! That works for me.