01. Installation
Development:
- Download this repo as zip or using git.
git clone https://github.com/djynnius/zedekframework.git
or
composer create-project openimo/zedekframework
-
set permissions to allow reading and writing to the zedekframework folder which may be renamed to any name of your choice and placed in any location.
-
Navigate to the public folder in zedek from command line and from there run the command:
php -S localhost:8080 zedek
that will start the php wsgi on port 8080 or any other port which you specify.
alternatively you may start from the root of the framework with:
php zedek start
This will start it on port 8585 (localhost:8585)
Production:
For production preferably using apache on which zedek has been tested there are 2 scenarios:
- Web root installation: move the contents of the public folder into your apache web folder and edit the line:
Route::anchor(); //pass in the path to your zedek core ending with a trailing slash
eg:
Route::anchor("/home/my_account/zedek/");
or on windows:
Route::anchor("c:\users\my_acount\zedek\");
to point to the anchor file in the zedek folder which should be non web accessible for security reasons. You should be able to access the framework from http://localhost or your FQDN.
- Ensure you have mod_rewrite enabled and properly configured.
Bulding your application:
Now that you have successfully installed Zedek its time to build your first application. But first lets explain how it works.
Zedek is built to map urls to controllers and methods in a style: http://mysite.com/controller/method/id/?arg1=val1&arg2=val2...argn=valn or where the installation is in a subfolder http://mysite.com/sub/folder/controller/method/id/?arg1=val1&arg2=val2...argn=valn (this mapping is handled primarily by a class named ZURI).
To create a new app called foo create a folder with the name foo within the engines folder. within this create a file and name it "controller.php". within the controller file enter the following code
<?php
namespace __zf__;
class CController extends ZController{
function bar(){
print "Hello World";
}
}
Browse to http://mysite.com/foo/bar
and you should see your hello world message!
The creation of the model file has also been automated. To use this feature ensure that the /zedek/engines/ folder is writable. run the static method CController::create("foo") from your application. This will create the
/zedek/engines/foo folder /zedek/engines/foo/controller.php and the /zedek/engines/foo/views/ folder.
this script will create 2 classes in your model file, 1 for CController and the other as a simpletest (PHP Unit testing) class.