Distributing custom yii2 app with composer

Dear Yii2ers,

I struggle a bit on this one, so I’d appreciate a little help from composer and github wizards.

I installed a basic Yii2 app with composer (composer create-project). I added extensions with composer (always), as needed.

I developed my app (quickly thank you yii2 team).

I edited the composer.json to put another name (than yiisoft/yii2 I used companyname/projectname).

I pushed my development on github (entire tree, without vendor dir and a few other that were gitignored).

Now I’d simply like to deploy at customer site, and provide them with simple maintenance with composer update.

I made a simple composer.json file with just a require for my project (companyname/projectname) and when I run composer install, get all the software, including dependencies. Good. Except that my development now resides in vendor/companyname/projectname, and not in the root directory of the app.

Sooo, here am I. What do I need to do to get the same directory structure as I have on my development computer?

Do I need to specify a destination directory for my package (and only my package)? How?

Or do I need to do the first install with a composer create-project? What do I need extra to do this?

In addition, my packages reside in a non published (on packagist) repo.

Please tell me how I can get an exact same copy at the customer site from my repo and get it to update with composer updates.

Many thanks in advance.

Pierre

Sorry guys, wording wasn’t precise enough in subject line.

I want to deploy a Yii2 app with composer at a customer site, and I want the customer to be able to update with simple


composer install

or


composer update

statements.

So, I pushed my dev on github, in a new repo. I just have my dev, and composer.lock. No composer.json.

Here is what I found so far. Please correct me if I’m wrong. (Or confirm I’m right, because I’m not sure!)

To use composer create-project you HAVE TO have a packages.json file. It does not work with a composer.json file (correct?).

Here is my packages.json:

[font="Courier New"]

{

 "package":{


	"name" : "vendor/app",


	"description": "App description",


	"version": "1.0.0",


	"homepage": "http://github.com/vendor/app",


	"author": "me",


	"source": {


		"type": "git",


		"url": "http://github.com/vendor/app",


		"reference": "1.0.0"


	}


}

}

[/font]

Then run


composer create-project --repository-url=path/to/file/packages.json vendor/app destination/dir

I correctly fetches all files from github, and install dependencies in vendor.

So far so good.