PHP Classes

Kuarasy PHP MySQL Framework: Framework to develop PHP applications using MySQL

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 54 All time: 10,631 This week: 66Up
Version License PHP version Categories
kuarasy 1.0The PHP License5PHP 5, Databases, Libraries, Design P...
Description 

Author

This package implements a framework to develop PHP applications using MySQL.

It implements a model-view-controller (MVC) based framework to develop PHP applications using controller classes ready to be used in Web applications, Web APIs, and terminal console-based scripts that can be run from the cron tool.

The package also provides base classes to create new controllers, models, and views.

Picture of Victor Andeloci
Name: Victor Andeloci <contact>
Classes: 7 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 6x

 

Example

<?php

require_once('config.php');
require_once(
'Helper.php');
require_once(
'./controllers/Api.php');
require_once(
'./controllers/Cron.php');
require_once(
'./views/Base.php');

$action = $_REQUEST['action'] ?? null;
if (
$action) {

 
$api = new Api();
 
$api->interpretAction($action);

} else if (!empty(
$argv)) {

 
parse_str($argv[1], $params);
 
$task = $params['task'];

 
$cron = new Cron($task);
 
$cron->execute();

} else {

 
$viewObj = new BaseView();

 
$pathInfo = array_filter(explode('/', str_replace(BASEPATH, '', $_SERVER['REQUEST_URI'])));

 
$view = strtok(current($pathInfo), '?');
 
$path = (count($pathInfo) > 1) ? end($pathInfo) : null;

  if (!empty(
$view) && $viewObj->viewExists($view))
   
$viewObj->load($view, $path);
  else
   
$viewObj->load();

}


Details

Kûarasy

Just a simple PHP - MySQL framework

About

This is a very simple and basic PHP - MySQL framework. Help us improve it. Use as you wish.

Installation

1 - Update the database connection details in <code>/config.php</code>:

define('K_DB_NAME', '');
define('K_DB_USER', '');
define('K_DB_PASSWORD', '');

2 - If you are NOT running directly on server root, set the BASEPATH reference in <code>/config.php</code>:

define('BASEPATH', '/kuarasy'); // assuming you are running from https://localhost/kuarasy

and <code>/.htaccess</code>:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
# Force Trailing slash
RewriteRule ^((.*)[^/])$ /kuarasy/$1/ [L,R=301] # HERE

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /kuarasy/index.php [L] # AND HERE

Default view

As default, DEFAULT_VIEW is defined in <code>config.php</code>. It holds the directory name of your main frontpage. Load other views and web apps using the basic function load('view_name') from <code>/views/Base.php</code>

REST API

The basic REST API in this framework uses a action request field to define the task / route This action will call a method with same name from <code>/views/Base.php</code> or any of it's properties

After installation test it: http://localhost/kuarasy?action=status

Cron jobs

Each task uses a task field for identification. Try this on console:

php index.php task=say_hello

  Files folder image Files (27)  
File Role Description
Files folder image.github (1 directory)
Files folder imagecontrollers (6 files)
Files folder imagelog (1 file)
Files folder imagemodels (3 files)
Files folder imagetemplates (2 files)
Files folder imageuploads (1 file)
Files folder imageviews (3 files, 1 directory)
Files folder image_assets (1 file, 1 directory)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file config.php Aux. Auxiliary script
Plain text file Helper.php Class Class source
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:54
This week:0
All time:10,631
This week:66Up