Skip to content
John O'Grady edited this page Mar 26, 2017 · 4 revisions

Ecne Logo

Ecne Framework

  1. What is the Ecne Framework
  2. Installing the Framework
  3. Controllers
  4. Views
  5. Classes
  6. Basic Example
  7. Advanced Example

What is The Ecne Framework

The Ecne Framework is a PHP web MVC & ORM framework. If you require an Model View Controller application when creating your website, or you need an easier more efficient way to access information from your database the Ecne Framework is a good choice of framework.

Installing The Ecne Framework

To install the Ecne Framework you first need to download the framework. The Ecne Framework is available on Github and it is recommended that you download a zip of the framework.

Once you have the zip folder containing the framework core files. Open the zip and copy all the contents inside the ecne-framework folder into your website root directory. Check the framework structure to the right.

Inside app is all the core functionality for this Model View Controller framework. We store the controllers inside the controllers folder. The controllers will be responsible for loading the correct view depending on where in your website a user goes. It will also be responsible for loading in models which store the dynamic data for the webpage, and serve it to the view to be rendered in a webpage.

Ecne Framework Structure

Project Root Folder/

    app/
        controllers/
        core/
        libraries/
        models/
        view/
    public/
        res/

Install Dependencies

With the command prompt still open, change the directory to the root directory of the ecne_framework folder. You will see a file name composer.json, this contains all the dependencies that Ecne is dependent upon and must be installed in order for Ecne to function. With the command prompt open and in the root folder of the ecne_framework folder, run the following command: composer install

This command will install all dependencies in a vendor folder and create an autoload file to be use in your project. This has already been defined in the index.php file in the root of ecne_framework directory. include_once BASE_PATH . '/vendor/autoload.php';

There aren't actually any dependencies to be installed, but running composer install in the directory that contains the composer.json file, this will create autoload.php for PSR-4 namespacing.

composer.json file

                        
{
    "name": "ecne/mvc",
    "description":  "MVC Framework",
    "minimum-stability": "stable",
    "license": "MIT",
    "authors": [
    {
        "name": "John P O'Grady",
        "email": "ogradyjp@ogradyjohn.com",
        "role": "Lead Developer"
    }
],
"autoload":{
    "psr-4": {
        "Ecne\\Controller\\": "app/controllers",
        "Ecne\\Model\\": "app/models",
        "Ecne\\Core\\": "app/core",
        "Ecne\\Library\\Core\\": "app/libraries/core",
        "Ecne\\Templator\\": "app/libraries/templator",
        "Ecne\\EmailTemplator\\":"app/libraries/emailtemplator",
        "Ecne\\ORM\\": "app/libraries/orm"
        }
    }
}

Confirm Installation

To confirm if the installation was successful, open your browser and point it to your project root folder.

I use localhost because I have the project running on a local web-server. If you are not running the project locally, you just point your browser to the domain name or IP address of your server. You should be brought to the default landing page. which look similar to the page below.

Ecne Default Landing Page

View Landing Page

To view the landing page just put in the below addresses into your browser. Change yourdomain.com to the domain your purchased from your web host if available, if you have a webserver installed on your computer, use http://localhost.

http://locallhost

or

http://yourdomain.com

Next up, learn how controllers work.