Installation

Setup Project

Requirements

  • PHP >= 7.0
  • Rewrite Module (nginix/apache2)
  • Composer

Instalation

From console level, launch the command composer*

$ composer create-project dframe/dframe-demo appName

Or

php composer.phar create-project dframe/dframe-demo appName

Composer is a tool for dependency management in PHP (You can install from here). It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

It will initialize the process of downloading the latest version of code available on github.com

You can also enter the repository and download the code in Dframe-demo.zip. and run:

$ composer install

After that you should have new project app skeleton.

Directory Permissions

Not all folders exist at the start, but there are some. All files and folders, except for the ones listed below, should have chmod 755 for folders and chmod 664 for files. Does not apply to the ones listed below, which should have group permissions of www-data

chmod 777 -R app/View/cache
chmod 777 -R app/View/templates_c
chmod 777 -R app/View/uploads

How change permissions for a folder and all of its subfolders and files in Linux?

To change all the directories to 755 (drwxr-xr-x):

$ find /opt/lampp/htdocs -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r--r--):

$ find /opt/lampp/htdocs -type f -exec chmod 644 {} \;

HTTP Server

After installing, you should configure web server's document /web. Make sure you have loaded mod_rewrite

RewriteEngine On

#Deny access for hidden folders and files
RewriteRule (^|/)\.([^/]+)(/|$) - [L,F]
RewriteRule (^|/)([^/]+)~(/|$) - [L,F]

#Set root folder to web directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1

#Redirect all queries to index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/index.php [QSA,L]
#Set root folder to web directory
location / {
    root   /home/[project_path]/htdocs/web;
    index  index.html index.php index.htm;
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?q=$1 last;
    }
}

#Redirect all queries to index file
location ~ .php$ {
    try_files $uri = 404;
    fastcgi_pass 127.0.0.1:9000;
    #fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    fastcgi_index web/index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

Configuration

After installation in file web/config.php you will find constant variables that are visible throughout the entire project. They should be set after installation.

<?php

// Application name
define('APP_NAME', "App name");  

// Check PSR-2: Coding Style
define('CODING_STYLE', true);    

// Website configuration
define('VERSION', "Dframe");     // Version aplication
define('SALT', "YOURSALT123");   // SALT default: YOURSALT123

// Website adress
define('HTTP_HOST', 'website.url');

Edit page (Installation/overview)