Search code examples
phpasana

Asana Installation using composer


I am trying to install the asana library through the composer.

Json:

"asana/asana": "^0.10.0" added to composer.json and {
            "name": "asana/asana",
            "description": "A PHP client for the Asana API",
            "type": "library",
            "keywords": ["asana", "client"],
            "homepage": "https://github.com/Asana/php-asana",
            "license": "MIT",
            "require": {
                "php": ">=5.4.0",
                "nategood/httpful": "~0.2",
                "adoy/oauth2": "^1.2.0"
            },
            "require-dev": {
                "instaclick/php-code-sniffer": "dev-master",
                "phpunit/phpunit": "^9"
            },
            "autoload": {
                "psr-0": {
                    "Asana\\": "src/"
                }
            }
        }

to composer.lock but getting error 'Package Asana/asana has no version defined. '


Solution

  • As suggested by @Jeto you should not edit composer.lock manually. To install the library, you can follow the steps mentioned in official docs here. Assuming that you are doing a fresh install, follow steps below:

    1. Put "asana/asana" package as a dependency in your composer.json file:
    {
        "require": {
            "asana/asana": "^0.10.0"
        }
    }
    
    1. Now run the command composer install

    composer.lock file will be automatically updated by Composer when installation succeed.

    EDIT:

    OR

    As mentioned by @Jeto in comments, You can simply do this using a single command: composer require asana/asana:^0.10.0