Francesca Framework

modern and lightest PHP framework developed with for developers


Enjoy Francesca :)



Introduction


Francesca Framework is a multi-tenant PHP framework that lets you develop PHP based websites, web applications, microservices and APIs quickly, securetly and cleanly. Francesca is a perfect tool for any developer who wants write scalable and long time manteinable web applications. In this page you can find an essential documentation.

Features

Modern and lightest MVC PHP framework that helps you quickly write powerful and secure web apps and APIs.

  1. extremely easy to learn and use
  2. friendly and commented construction
  3. multi-tenant configurations and apps manager
  4. composer installation
  5. custom CLI tools
  6. schelude cron tasks
  7. MVC http routing
  8. classes autoloader
  9. middlewares support
  10. RESTful support
  11. MySql and Sqlite ORM
  12. native PSR-4 support
  13. only 69kb files size
  14. PHP Unit Test support
  15. active updates and support

Requirements

All you need to Francesca Framework is a good and professional web hosting service or cloud VPS.

  1. Apache based web-server (or hybrid nigix/Apache)
  2. PHP 7.0 version or later
  3. PDO extension
  4. Composer extension
  5. SSH access to public root with writible permission on it

Basic concepts

Envs

Francesca Framework is a multi-tenant framework that manages one or more hostnames through environments configuration files.
After installation you can find a default environment file into "envs" folder and one "default" app into "apps".
You can create multiple environments configurations just creating domain.ltd.php configuration file into "envs" folder.
As default www.domain.ltd and domain.ltd use the same domain.ltd.php configuration file but if you create a www.domain.ltd.php file and one domain.ltd.php file you are able to obtain differents behaviors for "www" and "without www" requests.
You can use subdomains hostnames too (subdomain.domain.ltd.php configuration file into "envs" folder).

Custom settings

Francesca Framework provides a global array constant and one classes object.
"fra_var" is a global constant and includes an array with all global environment vars and "fra" is an object that includes all framework classes.
In every single app you can add one or more variables into "fra_var" array through "apps/[YOUR-APP-NAME]/config.php" file adding a $fra_config var.
You can install 3th parts libs through composer.
You can update the dependences list into composer.json file and run "composer update" CLI istruction. Then you can inizialize all new classes into main singleton "$fra" pattern (ex. $fra->classname) through "apps/[YOUR-APP-NAME]/core.php".

Helpers & functions

Francesca Framework includes many native helpers and functions categorized in text, date, form, tool, file, http and ways. You can find their API in the next sections of this document.

Database ORM

As default, Francesca Framework includes an useful 3th part ORM for MySql/sqlite connections: Medoo.
You can use all Medoo APIs through "$fra->data" pre-initialized object.

Mail sender

As default, Francesca Framework includes an useful 3th parts library to manage authenticated SMTP mail sender: PHPmailer.
You can use all PHPmailer APIs through "$fra->mail" pre-initialized object.

Installation

All you need to install Francesca Framework is an SSH access to public root folder and Composer.
After login into public root folder run this command:

composer create-project andreapollastri/francescaframework .

Configuration

Create a new application

First step to config Francesca Framework is generate a new Application folder.
You can do it via SSH into public root forder running this command:

php fra createapp YOUR-APP-NAME

No spaces and no special characters are permitted in YOUR-APP-NAME.
You can only use letters, numbers, points, underscores and dashes.
One single app can be associate to one or more tenants through environment files.

Create a new environment

Every single tenant is associated to one environment configuration file.
You can create it via SSH into public root forder running this command:

php fra createenv DOMAIN.LTD
.
No spaces and no special characters are permitted in DOMAIN.LTD.
You can only use letters, numbers, points, underscores and dashes.
Default environment file is used as default for all not defined tenants.

Set crons

Francesca Framework manages 1 minute 1 hour and 1 day crons.
To use crons you have to set a one minute task on the cron.php page.

Via URL

http://domain.ltd/cron.php
Via cron tab (remember to specify a tenant cron per cron):
* * * * *  php path/to/public/root/cron.php   domain.ltd
You can find and use 1m.php, 1h.php and 1d.php files into apps/YOUR-APP-NAME/tasks folder to create scheduled functions into the framework ecosystem.

Globals

You can set multi-tenants globals constants or "special functions" into globals.php file.
You can find it into public root. This feature is useful to set global constants for multiple environments.

Configuration file

Every configuration file includes different constants.

PART 1 - General information about application / environment
These are basic informations, not important for functionality of framework.

                        //Define an application name... (ex: My Website, Prod App, Staging App, ...)
                        $fra_config["name"]                             = "francesca.io configuration example";
                        //Define a version of app... (ex: 1.3 or beta, ...)
                        $fra_config["version"]                          = "1";
                        

PART 2 - Application folder
This is an important parameter. You can define app folder to use into current environment.
      
                                //Define the application folder
                                $fra_config["folder"]                           = "default";
                        

PART 3 - Timezone
Global timezone to use into environment.
      
                                //Define a global timezone for the app
                                $fra_config["timezone"]                         = "Europe/Rome";
                        

PART 4 - Logs
You can decide to enable logging system and its level.
You can find logs files into "logs" folder.
                                //Set Logs (0 - no logs, 1 - only errors logs, 2 - all logs)
                                $fra_config["logs"]                             = 0;
                        

PART 5 - Output minify
Enabling "minify" you can minify all HTML view output.
    
                                //Set HTML output minify (0 - no minify, 1 - minify)
                                $fra_config["minify"]                           = 0;
                        

PART 6 - Default settings
You can setup a default routing or a default redirect.
    
                                //Set Default Routing (home page)
                                $fra_config["default_controller"]               = "pages";
                                $fra_config["default_action"]                   = "home";
                                //Set a main default redirect (https://domain.xyz) or keep empty
                                $fra_config["default_redirect"]                 = "";
                        

PART 7 - Errors settings
You can setup an errors routing or an error redirect.
    
                                //Set Error Routing (404 page)
                                $fra_config["error_controller"]                 = "pages";
                                $fra_config["error_action"]                     = "error";
                                //Set a 404 redirect (https://domain.xyz) or keep empty
                                $fra_config["error_redirect"]                   = "";
                        

PART 8 - Database settings ($fra->data object)
You can config a Medoo database ORM connection.
    
                                //Framework Database Class (0 - disable, 1 - enable)
                                $fra_config["db_conn"]                          = 0;
                                //Set Database Type (mysql, sqlite)                                 
                                $fra_config["db_type"]                          = "mysql";  
                                //Set sqlite DB File Name and dir (ex. /var/www/domain.xyz/file.sqlite)                 
                                $fra_config["db_file"]                          = "";   
                                //Set DB host                               
                                $fra_config["db_host"]                          = "localhost";
                                //Set DB host port
                                $fra_config["db_port"]                          = "3306";   
                                //Set DB name               
                                $fra_config["db_name"]                          = "";
                                //Set DB table_prefix
                                $fra_config["db_pref"]                          = "";   
                                //Set DB charset
                                $fra_config["db_cset"]                          = "utf-8";
                                //Set DB username/password              
                                $fra_config["db_user"]                          = "";                   
                                $fra_config["db_pass"]                          = "";   
                        

PART 9 - Mail sender ($fra->mail object)
You can config phpMailer settings.
    
                                //Set Send Mail enable/disable
                                $fra_config["mail_status"]                      = 0;
                                //Set Send Mail Debug
                                $fra_config["mail_debug"]                       = 0;
                                //Set Send Mail SMTP host
                                $fra_config["mail_smtp_host"]                   = "";
                                //Set Send Mail SMTP host port
                                $fra_config["mail_smtp_port"]                   = 587;
                                //Set Send Mail SMTP host auth
                                $fra_config["mail_smtp_auth"]                   = true;
                                //Set Send Mail SMTP host auth type
                                $fra_config["mail_smtp_secure"]                 = "tls";
                                //Set Send Mail username/password
                                $fra_config["mail_user"]                        = "";
                                $fra_config["mail_pass"]                        = "";
                                //Set Default Send Mail "From" address/name
                                $fra_config["mail_from"]                        = "";
                                $fra_config["mail_name"]                        = "";
                                //Set Default Send Mail "Reply To" address
                                $fra_config["mail_reply"]                       = "";
                        

PART 10 - File uploads ($fra->file object)
You can set an array of global valid upload extensions.
    
                                //Extensions file allowed in uplaod 
                                $fra_config["upload_allow"]                     = Array("txt","doc","docx","ods","pdf","jpg","jpeg","png","gif","zip");
                        

PART 11 - FTP settings ($fra->file object)
You can config global FTP settings.
                                //Set FTP service enable/disable
                                $fra_config["ftp_status"]                       = 0;
                                //Set FTP hostname
                                $fra_config["ftp_host"]                         = "";
                                //Set FTP username
                                $fra_config["ftp_user"]                         = "";
                                //Set FTP password
                                $fra_config["ftp_pass"]                         = "";
                                //Set FTP port
                                $fra_config["ftp_port"]                         = 21;
                                //Set SSL connection (0 - FTP, 1 - SFTP)
                                $fra_config["ftp_sftp"]                         = 0;
                                //Set FTP base path
                                $fra_config["ftp_path"]                         = "";
                        

PART 12 - Env mode - SSL
You can manage HTTPS behavior.
                                //SSL mode (0 - no preference, 1 - force SSL)
                                $fra_config["ssl_mode"]                         = 0;
                        

PART 13 - Env mode - www
You can manage www.domain behavior.
                                //WWW mode (0 - no preference, 1 - force WWW, 2 - force NO WWW)
                                $fra_config["www_mode"]                         = 0;
                        

PART 14 - Env mode - other methods
You can manage other mode methods and their settings.
        
                                //Preview MODE (0 - disable, 1 - enable)
                                $fra_config["preview_mode"]                     = 0;
                                //Out Of Service MODE (0 - disable, 1 - enable)
                                $fra_config["outofservice_mode"]                = 0;
                                //Go Live MODE (0 - disable, 1 - enable)
                                $fra_config["golive_mode"]                      = 0;
                                //Go Down MODE (0 - disable, 1 - enable)
                                $fra_config["godown_mode"]                      = 0;
                                //Debug Mode (0 - disable, 1 - enable)
                                $fra_config["debug_mode"]                       = 0;
                                //////////////////////////////////////////////* APPLICATION MODES VAR */////
                                ////////////////////////////////////////////////////////////////////////////
                                //Define Go Live Date (aaaa-mm-yy hh:mm:ss)
                                $fra_config["golive_date"]                      = "2020-01-01 00:00:00";
                                //Define Go Down Date (aaaa-mm-yy hh:mm:ss)
                                $fra_config["godown_date"]                      = "2022-01-03 00:00:00";
                                //Set Out Of Service Routing
                                $fra_config["outofservice_controller"]          = "";
                                $fra_config["outofservice_action"]              = "";
                                //Set a Out Of Service redirect (https://domain.xyz) or keep empty
                                $fra_config["outofservice_redirect"]            = "";
                                //Set Go Live Routing
                                $fra_config["golive_controller"]                = "";
                                $fra_config["golive_action"]                    = "";
                                //Set a Go Live redirect (https://domain.xyz) or keep empty
                                $fra_config["golive_redirect"]                  = "";
                                //Set Go Down Routing
                                $fra_config["godown_controller"]                = "";
                                $fra_config["godown_action"]                    = "";
                                //Set a Go Down redirect (https://domain.xyz) or keep empty
                                $fra_config["godown_redirect"]                  = "";
                                //Set App Preview Allow IP list
                                $fra_config["preview_ipallow"]                  = array();
                                //Set Debud Allow IP list
                                $fra_config["debug_ipallow"]                    = array();
                        

PART 15 - PHP ini error
You can decide to enable or disable php ini errors.
                                //Set PHP INI Errors View (0 - no, 1 - yes)
                                $fra_config["debug_inierror"]                   = 0;
                        


You can override configuration into single application using $fra_config vars into "apps/YOUR-APP-NAME/config.php" file.
Every setting is available into fra_var constant array.
There are other vars into it too:
current_date (Y-m-d)
current_time (H:i:s)
ssl (true/false)
url (http://domain.ltd)
uri (/pages/about-us/)
domain (domain.ltd)
path (/path/to/public/root/)
assets (http://domain.ltd/apps/APPNAME/assets/)
files_path (/path/to/public/root/apps/APPNAME/files/)
files (http://domain.ltd/apps/APPNAME/files/)
error (404, 403, etc...)
url_paths (array composed by controller, action, id, varj, vark, varw, varx, vary, varz values)

Multi-tenant

You can manage multiple environments and applications through environments config files and applications folders.
You can manage, for example, staging.domain.ltd URL with its staging.domain.ltd.php "envs" file to use apps/staging/ application and domain.ltd with its domain.ltd.php "envs" file to use apps/production/ application.
You can config domain, www.domain and no-level-limit subdomains (so you can manage for example api.domain.ltd and login.microservices.domain.ltd).
You can config multiple tenants to one app.
All not configured tennats uses "default" env config file by defaut.

Routing

Logic

In Francesca Framework all HTTP requests are managed by an MVC pattern that applies security rules like disable .php pages directly requests, disable explits get requests (as page/?id=293&q=test), escape special characters and forbid access to system folders/files.
All requests are into Francesca Framework core excluded direct static content requests (ex. domain.ltd/apps/APPNAME/assets/css/style.css or domain.ltd/google_verify.txt).

Vars schema

Francesca Framework MVC logic consist in this schema:
controller (controller page request -> current app MVC sub-folder)
action (sub-controller page request -> current controller sub-page)
id (one ID var that let you identify STRING or IDS relative to current request)
varj (free and customizable get var to use into framework)
vark (free and customizable get var to use into framework)
varw (free and customizable get var to use into framework)
varx (free and customizable get var to use into framework)
vary (free and customizable get var to use into framework)
varz (free and customizable get var to use into framework)
All these parameters are into fra_var constant array (ex. fra_var["varj"]).

MVC configuration

Francesca Framework MVC logic works on app file system and folder structure.
Every app contains the folders:

  • - CONTROLLERS
  • - MIDDLEWARES
  • - MODELS
  • - LAYOUTS
  • - VIEWS
In every MVC folder we can put another folder with the desidered "controller" name.
Into there we have to put an index.php file that is the default action for every "only-control" request (ex. domain.ltd/controller/).
Every request includes system files in this order:
apps/AppName/models/CONTROLLER.php if exists
apps/AppName/models/CONTROLLER/ACTION.php if exists
apps/AppName/controllers/CONTROLLER.php if exists
apps/AppName/controllers/CONTROLLER/ACTION.php if exists
apps/AppName/middlewares/CONTROLLER.php if exists
apps/AppName/middlewares/CONTROLLER/ACTION.php if exists
apps/AppName/layouts/CONTROLLER.php if exists or apps/AppName/views/CONTROLLER/ACTION.php
This method lets you show a simple only view page (without models or controller - ex. static content) or a middlewares (ex. for APIs) or combine all them to create a complex MVC system with views, middlewares, models and controllers without any route class or pre-defined route variable.
Remeber that default action for any controller is "INDEX" (if you don't declare any explicit action) and that you have to define a default routing for the env (ex. domain.ltd start with implict but not showed in URL "/pages/home/"" controller and action)... so Francesca Framework routing is SEO and user friendly.
All get requests post "action" (id, varj, vark, varw, varx, vary, varz) are utilizable as GET vars into the framework but are not useful to MVC structure/functionality.
Every app includes an ending.php file so you can add common functions or custom logs in the end of MVC structure.

Template

Basic use of Francesca Framework MVC system is through "views". Every single controller/action have to have a single action middleware and/or a single action view PHP page.
This method is not confortable to manage comples websites or webapps structures and templates so you can use "layouts" and "snippets".
You can compose complex and differents layouts controller per controller.
For example...

APPNAME/
    /layouts/
        backend.php
        frontend.php
    /snippets/
        backend_header.php
        backend_menu.php
        backend_footer.php
        frontend_header.php
        frontend_menu.php
        frontend_sidebar.php
        frontend_footer.php
    /views/
        /frontend/
            index.php
            about.php
            portfolio.php
            contact.php
        /backend/
            index.php
            login.php
            insert.php
            edit.php
            delete.php
            logout.php
                        
You can compose backend layout in this way:
$fra->ways->getsnip("backend_header");
$fra->ways->getsnip("backend_menu");
$fra->ways->getview();
$fra->ways->getsnip("backend_footer");
                        
And you can compose frontend layout in this way:
$fra->ways->getsnip("frontend_header");
$fra->ways->getsnip("frontend_menu");
$fra->ways->getview();
$fra->ways->getsnip("frontend_sidebar");
$fra->ways->getsnip("frontend_footer");
                        
In this way you can create differents and complex templates based on controllers and action requests with commons snippets.

Helpers

Tool

The Francesca/Tool is a set of generic tools

$fra->tool->exceptions(EXCEPTIONS, VAR)
This functions verifies if still one value of an"expentions" array is like a selected var and returns TRUE/FALSE.

$fra->tool->combinations(ARRAYS)
This functions takes an array of arrays and combines them into a multi-array matrix.

$fra->tool->logit(DATA, NAME)
This function lets you log everything with a custom name and a custom array of data.

$fra->tool->logitlight(DATA, NAME)
This function lets you log a custom array of data with a custom name.

$fra->tool->isonline(URL)
This function checks if an URL is or not on-line and returns TRUE or FALSE value.

$fra->tool->redirect(URL)
This function redirects to an URL.

$fra->tool->jsontoarray(JSON)
This function returns an array from a JSON

$fra->tool->jsonfromarray(ARRAY)
This function returns a JSON from an ARRAY

$fra->tool->sessionset(VARS)
This function adds an array of vars to session.

$fra->tool->sessionread(VAR)
This function returns a VAR session value.

$fra->tool->cookieset(NAME, VALUE)
This function sets a cookie with a name, a value and a time in second (ex. 86400 -> 1day, 3600 -> 1h, ...).

$fra->tool->cookieread(NAME)
This function returns a cookie value.

$fra->tool->encrypt(STRING, KEY)
This function encrypts a STRING with a KEY.

$fra->tool->decrypt(STRING, KEY)
This function decrypts a STRING with a KEY.

$fra->tool->password(LENGHT)
This function returns a LENGHT password.

$fra->tool->code(LENGHT)
This function returns a LENGHT code.

$fra->tool->coden(LENGHT)
This function returns a LENGHT numeric code.

$fra->tool->codean(LENGHT)
This function returns a LENGHT alfanumeric code.

$fra->tool->unique()
This function returns an unique code.

$fra->tool->string()
This function returns an unique string.


Ways

The Francesca/Ways is routing tools

$fra->ways->getview()
This function includes current controller/action view into a layout;

$fra->ways->getsnip(NAME)
This function includes a page snippet everywehere.


Text

The Francesca/Text is a set of fuctions useful for work with text

$fra->text->replace(TEXT, STRING, NEWSTRING)
This function replaces a STRING with a new STRING into a TEXT.

$fra->text->length(STRING)
This function returns the length of a string.

$fra->text->left(STRING, CHARS)
This function returns first CHARS of a STRING.

$fra->text->right(STRING, CHARS)
This function returns last CHARS of a STRING.

$fra->text->lefttrim(STRING, CHARS)
This function trims first CHARS of a STRING.

$fra->text->righttrim(STRING, CHARS)
This function trims last CHARS of a STRING.

$fra->text->truncate(STRING, CHARS, END)
This function truncates a string at a CHARS n° of letters and appends an end (ex. ...).

$fra->text->reverse(STRING)
This function returns a reversed STRING.

$fra->text->uppercase(STRING)
This function returns an uppercase STRING.

$fra->text->lowercase(STRING)
This function returns an lowercase STRING.

$fra->text->capitalize(STRING, OPTION)
This function returns a capitalize STRING (opt. 0) or a full words capitalize STRING (opt. 1).

$fra->text->wrap(STRING, CHARS, TAG)
This function inserts a TAG every CHARS in STRING.

$fra->text->words(STRING)
This function counts words in STRING.

$fra->text->brfromn(STRING)
This function returns STRING \ n into BR.

$fra->text->brton(STRING)
This function returns STRING BR into \ n.

$fra->text->slug(STRING, DELIMITER)
This function returns a SLUG from a STRING using a DELIMITER.

$fra->text->utf8(STRING)
This function returns an UTF-8 string.


Form

The Francesca/Form is a set of functions for form validation

$fra->form->clean(STRING)
This function cleans a STRING from dangerous characters.

$fra->form->cleanlight(STRING)
This function cleans a STRING from dangerous characters (in light version).

$fra->form->isurl(STRING)
This function verifies if a string is an URL and returns a TRUE or FALSE value.

$fra->form->ismail(STRING)
This function verifies if a string is an E-MAIL and returns a TRUE or FALSE value.

$fra->form->isnotempty(STRING)
This function verifies if a string is not empty and returns a TRUE or FALSE value.

$fra->form->isanumber(STRING)
This function verifies if a string is a number and returns a TRUE or FALSE value.

$fra->form->isinto(STRING, WORD)
This function verifies if in a STRING there is one (or more) WORD returning TRUE or FALSE value.

$fra->form->ismim(STRING, LONG)
This function verifies if a STRING is minium LONG and returns TRUE or FALSE value.

$fra->form->ismax(STRING, LONG)
This function verifies if a STRING is maxium LONG and returns TRUE or FALSE value.


Date

The Francesca/Date is a set of fuctions useful for work with dates

$fra->date->now()
This function returns current datetime in standard format as a string.

$fra->date->convert(DATE, TO FORMAT, FROM FORMAT)
This function converts date format using PHP date() standard formats of a declared DATE, FROM a format TO a new format.

$fra->date->days(DATE A, DATE B)
This function returns as a string the number of days beetweek two dates (better in Y-m-d format).

$fra->date->change(DATE, REQUEST, FORMAT)
This function returns as a string a new date based on an original date and based on a request.


File

The Francesca/File is a set of functions to manage files

$fra->file->exists(FILE)
This function verifies if a FILE exists and returns a TRUE or FALSE value.

$fra->file->extension(FILE)
This function returns a FILE extension.

$fra->file->read(FILE)
This function reads a FILE and returns a string.

$fra->file->create(FILE, CONTENT)
This function creates a FILE with a CONTENT and returns a string.

$fra->file->createdir(DIR)
This function creates a DIR.

$fra->file->delete(FILE)
This function deletes a FILE.

$fra->file->deletedir(DIR)
This function deletes a DIR.

$fra->file->list(DIR)
This function lists the files into a DIR and returns an array.

$fra->file->upload(DIR, EXTENSIONS)
This function uploads all $_FILES into a DIR verifing files EXTENSIONS (array) and returns an array of files names.

$fra->file->heading(TYPE, CUSTOM)
This function returns a custom file header.

$fra->file->forcedownload(FILE)
This function forces file download.

$fra->file->ftpget(LOCALFILE, REMOTEFILE)
This function lets you to download a remote FTP file into a local file.

$fra->file->ftpput(LOCALFILE, REMOTEFILE)
This function lets you to upload a local file into a remote FTP file.

$fra->file->ftpdel(FILE)
This function lets you to delete a remote FPT file.

$fra->file->ftpcreatedir(DIR)
This function lets you create a remote FTP dir.

$fra->file->ftpdeletedir(DIR)
This function lets you delete a remote FTP dir.

$fra->file->ftpdeletedir(DIR)
This function returns an FTP dir content array.


Http

The Francesca/Http class manages all HTTP methods reqs.

$fra->http->to(METHOD, URL, DATA, HEADER)
This function sends DATA (array) to an URLwith a custom HEADER (array) through a METHOD.

$fra->http->from(METHOD, IP)
This function receives data trasmitted to page in a determinated METHOD from an optional list of IP (array or string).

$fra->http->response(CODE)
This function returns a custom CODE header.

$fra->http->responseget(URL)
This function gets and returns an URL header.


Auth

The Francesca/Auth provides a set of auth functions

$fra->auth->passwordhash(SECRET PASS)
This function creates an encrypted password based on BCRYPT algorit and return it as a string.

$fra->auth->passwordcheck(SECRET PASS, PASS HASH)
This function validates a BCRYPT encrypt password and return a TRUE or FALSE value.

$fra->auth->tokengenerate()
This function creates an univoque token, puts it in "fra_auth_token" server session and return it into a string.

$fra->auth->tokenverify(INPUT TOKEN)
This function verify the input token with the "fra_auth_token" session and return a TRUE or FALSE value. This function manages also "fra_auth_session_token" and "fra_auth_session_try".

$fra->auth->otpgenerate()
This function creates an temporaney otp code, puts it into a "fra_auth_otp" server session and return it as a string.

$fra->auth->otpverify(INPUT OTP)
This function verify the input opt with the "fra_auth_otp" and return TRUE or FALSE

$fra->auth->start(LEVEL)
This function start a login session and set an optional user level identify by a number putting all in 2 sessions: "fra_auth_session" and "fra_auth_level".

$fra->auth->verify(LEVEL)
This function validates user session and user level (optional) returning a TRUE or FALSE value.

$fra->auth->stop()
This function stops all user sessions.

$fra->auth->level()
This function returns user level into a string

$fra->auth->try(VALUE NUMBER)
This function adds a VALUE NUMBER to user try session.

$fra->auth->tryverify(MAX NUMBER)
This funcion verifies if max value of session try is equal to current user session try value and return TRUE or FALSE value.


Data

As default, Francesca Framework includes an useful 3th parts ORM for MySql/sqlite connections called Medoo.
You can use all Medoo APIs through $fra->data pre-initialized object. All init configurations are into environment file.


Mail

As default, Francesca Framework includes an useful 3th parts library to manage authenticated SMTP mail sender called PHPmailer.
You can use all PHPmailer APIs through $fra->mail pre-initialized object. All init configurations are into environment file.

Libraries

In every app you can create custom libraries or classes and use them into your cose

How create a custom library

Create a new library folder and php file into apps/Appname/libraries/Newlibname/Newlibname.php and intializied it with the same noun as namespace and class...

                        // This is the Operations.php file
                        namespace Operations;
 
                        class Operations {

                            //here you can put your functions

                        }

                        

Then you have to load it into apps/Appname/core.php page and register it into the singleton fra object.

                        //for example
                        use Operations\Operations;
 
                        // Register as singleton object
                        $fra->operations = New Operations(OPTIONAL INIT CONFIG);
                        
Any libraries init configuration can be declared as $fra_config["VAR-NAME"] var into apps/Appname/config.php page.

3th parts

Install vendors

To install a 3th parts lib you have to update dependences list into composer.json file with composer 3th parts libs packages names and runninng into public root folder this SSH command:

composer update

Singleton logic

Francesca Framework provides singleton function to register a new singleton object. You can create and return 3th parts libs as object into the framework. You can do it into apps/Appname/core.php page. Any classes init configuration can be declared as $fra_config["VAR-NAME"] var into apps/Appname/config.php page.
You can register it in this way:

                        // Use Lib namespace
                        use Lib\Lib;
 
                        // Register as singleton object
                        $fra->lib(OPTIONAL INIT CONFIG);
                        

Reserved objects names are: ways, data, mail, file, text, date, form, http, auth, tool and core.

CLI tools

Francesca Framework provides an essential and minimal set of php CLI tools that you can use in SSH into public root folder.

php fra - is a welcome messagge
php fra help - is an available commands list
php fra list-envs - is useful to read a list of environments and their routes structure
php fra reset-ht - is useful to restore original .htaccess file in case of problem
php fra reset-log - is useful to empty logs folder
php fra create-env - is useful to create envs files
php fra create-app - is useful to create apps folders

CDN tools

Andrea Pollastri (Francesca Framework creator) pubblished All You Can Cloud... a simple website that provieds you a set of tools, resources, assets and snippets useful to quickly and secure develop websites and webapps!
You can easly create PDF, resize images, include Bootstrap framework, etc... try it... it's free! good work! :)

Go to Website!

Support

For any information/issue about Francesca Framework write an email at: [email protected].

.