Starting a Kohana based PHP project using Git

When using Kohana for my PHP project, I like to keep Kohana in its own folder and as a seperate submodule in Git. This makes my own project very clean when uploading/pushing them to Github. I also restrict access to the PHP files by adding the Kohana index.php to a seperate folder.

Run the following commands in your project folder

	git submodule add git://github.com/kohana/kohana.git kohana
	cp -R kohana/application/ project
	mkdir webroot
	cp kohana/index.php webroot/
	chmod 777 project/cache/
	chmod 777 project/logs/
	cd kohana
	git submodule init
	git submodule update

Make sure the last command runs without any errors.

In webroot/index.php change the variables to the following settings

$application = '../project';
$modules     = '../kohana/modules';
$system      = '../kohana/system';

Add a alias or vhost pointing to the webroot folder in the project folder (where the index.php is). Adjust the $base_url variable in project/bootstrap.php to your URL.

See also http://kerkness.ca/wiki/doku.php?id=installing_from_github

Installing a submodule

I also use Sprig as my ORM. To add this module as a Git submodule I open a terminal in the kohana subfolder (inside the project folder) and run the following commands.

git submodule add git://github.com/sittercity/sprig.git modules/sprig
git submodule init
git submodule update

Enable it (along with database module) in the bootstrap.php inside the folder named project

Kohana::modules(array(
     'database'  => MODPATH.'database',   // Database access
     'sprig'     => MODPATH.'sprig',   // Sprig ORM
));
Dette innlegget ble publisert i Kohana og merket med , , , , , , , . Bokmerk permalenken.