Question

After searching through many PHP frameworks to figure out which to learn and use, I've tentatively settled on Lithium. It looks great. Except, I'm not entirely sure how to best manage the Lithium apps I write in git, because of the recommended way of getting the code. The manual suggests:

git clone git://github.com/UnionOfRAD/framework.git my_app
cd my_app
git submodule init
git submodule update

This results in a non-empty main repository (2000+ commits in the history at present). Should I simply be committing my own changes within this same repository (in my own branches?) and pulling/merging when there are changes, or is there some other way that's recommended?

I know that I can also just download the files without cloning the repository, but since the manual indicates this is recommended I figured there must be a good reason and an ideal way of doing it. (I presume it makes it easier to update the framework when a new version comes out.)

Was it helpful?

Solution

It depends on your preferred setup. If I want to quickly get rolling then a checkout of the example app works great. It has a bootstap config, example controllers and some views. But once you transcend that I suggest creating your own baseline app-repo and deploying the framework itself pr server and not pr app. The app/config/bootstrap/libraries.php can easily be changed to load lithium itself from elsewhere.

So

  1. Deploy lithium pr server (/home/lithium is my preference)
  2. Create your own baseline app by copying the default li3 one and stripping/modifying it
  3. Create a flexible vhost configuration so you can just git clone base-app ~/sites/foo-app, or similar, for quickly get rolling with a new app.

I have my (out-of-date by now) baseline app on github

OTHER TIPS

Yes. In git you get a copy of all the history. You can track your work in your own branch and synchronize as you see fit using pull or fetch.

Since you are using github, fork that repo and clone from the fork. Should you want to contribute, you can create pull requests.

EDIT:

Initially, all you need to do is clone:

git clone <url to the repo>
git submodule --init --recursive

If you are not contributing, then the workflow is easy from then on:

git fetch

to fetch the latest from github

git merge --ff-only origin/master
git submodule update --recursive

If you get errors because you changed a file by accident, you can

git reset --hard HEAD
git clean -xdf 

and start with the merge step again. You may need to go into the submodule directories and do the above 2 steps there if the changes happened there.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top