Just a simple PHP - MySQL framework
This is a very simple and basic PHP - MySQL framework. Help us improve it. Use as you wish.
1 - Create and set database connection details in /.env
:
DATABASE_HOST="localhost"
DATABASE_NAME="kuarasy"
DATABASE_USER="root"
DATABASE_PASSWORD="123"
2 - If you are NOT running directly on server root, set the BASEPATH reference in /config.php
:
define('BASEPATH', '/kuarasy'); // assuming you are running from https://localhost/kuarasy
and /.htaccess
:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
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
As default, DEFAULT_VIEW is defined in config.php
. It holds the directory name of your main frontpage.
Load other views and web apps using the basic function load('view_name') from /views/Base.php
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 /views/Base.php
or any of it's properties
After installation test it: http://localhost/kuarasy?action=status
Each task uses a task field for identification. Try this on console:
php index.php task=say_hello