Installing kytschBASIC
Requirements
PHP 7.4 to 8.3
PHP-GD
PHP-MySQL (Optional)
Get the source code
Now open your favourite terminal/console and clone the repo or use your favourite GUI git tool.
git clone https://github.com/kytschi/kytschBASIC.git
OR
git clone git@github.com:kytschi/kytschBASIC.git
Enable the module
You can copy the sample ini file from the `php` folder from the repo for the desired PHP version. Remember to do this as root or a user with administrator permissions.
cp kytschBASIC/php/kytschBASIC-8.3.ini /etc/php/8.3/mods-available/kytschBASIC.ini
Now enable the kytschBASIC module in your PHP-FPM install or however you run PHP on your webserver.
ln -s /etc/php/8.3/mods-available/kytschBASIC.ini /etc/php/8.3/fpm/config/50-kytschBASIC.ini
And don't forget to restart the PHP service.
Next setup an index.php on your webserver of choice and tell it to load the kytschBASIC compiler.
<?php
(new KytschBASIC\Compiler(__DIR__ . '/../config'))->run();
NOTICE we are loading in the configuration file. See configuration for more information on how to setup the configuration file.
For an example website checkout the source code for this one.kytschBASIC example
Configuration
kytschBASIC configuration is handled via JSON config files located in the config folder. From there you can define the database connection, the routes, etc. See kytschBASIC example configs for more information
Database
The configuration for the database connection if needed. You can define more than one.
[
{
"name":"kytschBASIC", <-- Name of the connection
"type": "mysql", <-- Connection type
"host": "127.0.0.1", <-- Host IP
"port": 3306, <-- Host port
"dbname": "kytschBASIC", <-- Name of the database
"user": "user", <-- Username that has access
"password": "password" <-- Password of the user
}
]
Routes
The routes allow you to define what kytschBASIC template is to be loaded for a specific URL or route.
[
{
"url": "/", <-- The URL/route that corresponds to the template.
"template": "project/index.kb" <-- The kytschBASIC template. Be sure to include its folder if its in one.
},
{
"url": "/about",
"template": "project/about.kb"
},
{
"url": "/installation",
"template": "project/installation.kb"
},
{
"url": "/news",
"template": "project/news.kb"
}
]
Building from source
First thing you will need is to install Zephir
Building the kytschBASIC PHP module.
cd kytschBASIC/kytschbasic
zephir build