System requirements

Webserver
  • Apache with mod rewrite (or equivalent server)
PHP
  • PHP 5.4 or higher

Quick Installation

Via Composer

  • The Eridko framework utilizes Composer for installation and dependency management. If you have not install Composer, start by installing Composer.

After you installed Composer, you can run the following command in your terminal:

composer create-project erdiko/erdiko project-name

This command will download and install a fresh copy of Erdiko in a new project-name folder within your current directory. Then, you can move to next step to Setup web environment

Via Github

Download Erdiko

To download Erdiko from our Git repository, enter the following command in command prompt:

git clone https://github.com/arroyolabs/erdiko

It will clone our Git repository to your local machince. Then, go to the Erdiko root folder and install Erdiko using Composer.

composer install

Setup web environment

  1. Open the config file of your web server

  2. Change the webroot to [local erdiko code path]/public

  3. Create a folder named var in [local erdiko code path]/ and change the group of the /var folder to www-data using chgrp www-data [local erdiko code path]/var

  4. Save changes and restart your web server.

  5. Type http://localhost into your browser (or your virtual host name)

  6. If you can see the Hello world page, you have successfully installed Erdiko!

Warning!

If you cannot open the Hello world page, go back to the config file of your web server to check if the port is 80. If the port is other than 80, you need to specify the port in Step 4. For example, if you port is 8080, the URL link will be http://localhost:8080 .

Heads up!

All of your server side application code should go in the /app folder while any js file, css file or asset should go in the /public folder.

Theme files go in the /public folder while view files and application code goes in the /app folder. Do not modify files in /vendor/erdiko/* if you want to maintain an easy upgrade path with Erdiko.

Create add your first page

  1. We will first need to add a tab to the menu. To do so, open the main config file located at Erdiko/app/config/application/default.json

  2. Find the menu section and insert the following code.

  1. After inserting the code above, the menu section should look like this.
  1. Save the changes of the file, and open the site in your browser. You should be able to see that there is a new tab on the menu.
Heads up! When you click on the tab, it will show error.

It is normal because you have not set any contents to the page.

Set content of a page

  1. To add contents to a page, open the page config file located at Erdiko/app/controllers/Example.php.

  2. Add the following function inside the Index class

  1. Save the changes and open the site in your browser. You should be able to see your first page.
Well done!

You successfully create your first page using Erdiko.

Heads up!

If you want to create a full page, you can add the following line in the getMyfirstpage function.

$this->setTemplate('fullpage');

Use a PHP template

  1. Open the corresponding controller file under the folder Erdiko/app/controllers/.

  2. Inside the controller, find the function of the page you want to use PHP.

  3. Insert the following code:

     $this->addView('[Path of the .php file]');
    
Heads up! The root of the path is `Erdiko/app/views`.
For example, if you want to use the php file located at `Erdiko/app/views/example/test.php`, the path will be `/example/test`.

Add JavaScript to a page

  1. Open the corresponding controller file under the folder Erdiko/www/app/controllers/.

  2. Inside the controller, find the function of the page you want to use Javascript.

  3. Insert the following code:

     $this->addJs('[Path of the .js file]');
    
Heads up! The root of the path is `/public/`.
For example, if you want to include the .js file located at `/app/themes/bootstrap/js/test.js`, the path will be `/themes/bootstrap/js/test.js`.

Add a BMI calculator page using Javascript

  1. Open the main config file located at /app/config/default/application.json

  2. Find the menu section and insert the following code.

    ,
     {
        "href":"/examples/bmi",
        "title":"BMI"
     }
    
  3. Open the routing config file located at /app/config/default/routes.json. We can see that sites located at / will be routed to the controller Index and sites located at /examples/ will be routed to the controller Example.

  4. Open the controller Example located at /app/controllers/Examples.php

  5. Add the following function inside the Examples class

  1. Create a file called bmi.php under /app/views/examples/

  2. Open the bmi.php and add the following code:

  1. Create example.js under the folder /app/themes/hello/js/

  2. Paste the following code to example.js

  1. Save all changes, and open a web brower.

  2. Go to localhost, click the BMI tab on the menu, and then you should see this.

Add a BMI calculator page using new route

  1. Open the main config file located at /app/config/default/application.json

  2. Find the menu section and insert the following code.

    ,
     {
        "href":"/Calculator/bmi_version2",
        "title":"BMI"
     }
    
  3. Open the routing config file located at Erdiko/app/config/default/routes.json. Add a new rule to the route.

    ["Calculator/([a-zA-Z0-9_\-/]+)", "\app\controllers\Calculator"],
    
  4. Then, we will need to create a new controller for the new route. To create a new controller, create Calculator.php under the folder /app/controllers/

  5. Paste the following code inside the Calculator.php

  1. Create a file called bmi.php under /app/views/examples/

  2. Open the bmi.php and add the following code:

  1. Create a file called bmi_post.php under /app/views/examples/

  2. Open the bmi_post.php and add the following code:

  1. Save all changes, and open the site in your web brower.

  2. Click the BMI tab on the menu, and then you should see the following results.

    BMI Version 2

    BMI Version 2 Result