Yii Framework Forum: Distributing custom yii2 app with composer - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Distributing custom yii2 app with composer How to maintain same directory structure? Rate Topic: -----

#1 User is offline   Pierre M 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 28-August 14

Posted 28 November 2014 - 12:25 PM

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
Don't force it. Use a bigger hammer. -- Unix fortune(1)
0

#2 User is offline   Pierre M 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 28-August 14

Posted 08 December 2014 - 09:58 AM

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:


{
"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"
}
}
}


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.
Don't force it. Use a bigger hammer. -- Unix fortune(1)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users