PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (27)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-10-01 (7 months ago) RSS 2.0 feedNot enough user ratingsTotal: 54 All time: 10,588 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: 6 packages by
Country: Brazil Brazil
Age: 25
All time rank: 4367354 in Brazil Brazil
Week rank: 89 Up4 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 5x

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  
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

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file release.yml Data Auxiliary data

  Files folder image Files  /  controllers  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file Api.php Class Class source
  Plain text file Base.php Class Class source
  Plain text file Cron.php Class Class source
  Plain text file Log.php Class Class source
  Plain text file Upload.php Class Class source

  Files folder image Files  /  log  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data

  Files folder image Files  /  models  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file Base.php Class Class source
  Plain text file Example.php Class Class source

  Files folder image Files  /  templates  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file cool_email.php Aux. Auxiliary script

  Files folder image Files  /  uploads  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data

  Files folder image Files  /  views  
File Role Description
Files folder imageexample (2 files)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file Base.php Class Class source
  Plain text file Console.php Class Class source

  Files folder image Files  /  views  /  example  
File Role Description
  Accessible without login Plain text file index.php Aux. Auxiliary script
  Accessible without login Plain text file subview.php Aux. Auxiliary script

  Files folder image Files  /  _assets  
File Role Description
Files folder imagecss (1 file)
  Accessible without login Plain text file .htaccess Data Auxiliary data

  Files folder image Files  /  _assets  /  css  
File Role Description
  Accessible without login Plain text file main.css Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:54
This week:0
All time:10,588
This week:66Up