Help With Composer For Yii2

Hi

I solved this so you may want to skip to the update part

Never used Composer, so giving it a bash. I have a new directory called "Yii2" it is inside my htdocs folder on XAMPP.

I have composer.phar (Downloaded from composer) inside my Yii2 folder too. I have tried to use the link from the docs for the advanced app.

php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced yii-advanced

I get a runtime error saying


[RuntimeException] Failed to clone, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as an internal or external command, operable program or batch file.

What have I done wrong? I’ve never used composer so any help would be appreciated when trying to fix this.

Update

I copied the composer.json file from Git:




{

        "name": "yiisoft/yii2-app-advanced",

        "description": "Yii 2 Advanced Application Template",

        "keywords": ["yii", "framework", "advanced", "application template"],

        "homepage": "http://www.yiiframework.com/",

        "type": "project",

        "license": "BSD-3-Clause",

        "support": {

                "issues": "https://github.com/yiisoft/yii2/issues?state=open",

                "forum": "http://www.yiiframework.com/forum/",

                "wiki": "http://www.yiiframework.com/wiki/",

                "irc": "irc://irc.freenode.net/yii",

                "source": "https://github.com/yiisoft/yii2"

        },

        "minimum-stability": "dev",

        "require": {

                "php": ">=5.4.0",

                "yiisoft/yii2": "dev-master",

                "yiisoft/yii2-swiftmailer": "dev-master",

                "yiisoft/yii2-bootstrap": "dev-master",

                "yiisoft/yii2-debug": "dev-master",

                "yiisoft/yii2-gii": "dev-master"

        },

        "scripts": {

                "post-create-project-cmd": [

                        "yii\\composer\\Installer::setPermission"

                ]

        },

        "extra": {

                "writable": [

                        "backend/runtime",

                        "backend/web/assets",


                        "console/runtime",

                        "console/migrations",


                        "frontend/runtime",

                        "frontend/web/assets"

                ]

        }

}



So when i used "php composer.phar install" it downloaded fine. So I now have a vendors folder inside my directory. Is that the whole framework, i.e should probably not be in my project folder and be in the xampp directory? I feel like it is meaning that I need to somehow still create an app?

Is that correct? Apologies if this is simple. I only started using Yii 1 recently and have never used Composer, so it’s a bit of a change. So if someone can point me in the right direction that would be great. I have read the current docs, but I still wasn’t sure.

Thanks

Jonny

You do not seem to have git installed. You can either install git / make it available in path or adjust the command of composer to not use git:


php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced yii-advanced --prefer-dist

Thanks Cebe,

I shall look into downloading git or not one of your options.

The vendor folder, it’s content and the composer.json and composer.phar I downloaded, should that be in my xampp folder? where I would have put my framework and protected folder if this was a Yii 1 install?

Ok think I fixed this. I managed to install the basic app using command line. Thanks