joonika/joonika

light open source php framework

Installs: 336

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 2

Open Issues: 0

Language:JavaScript

Type:framework

v0.1.3 2021-09-14 10:34 UTC

This package is auto-updated.

Last update: 2022-01-15 06:31:22 UTC


README

Install

curl -s https://get.joonika.com | bash && sh installer

During install Notes

if your domain has hosted on another port than 80,443 for domain answer please fill domain.com:9090
if you want to create file for that domain:port: just replace colon with underline(_)
domain.com_9090.yaml

joonika toolkit

Top instruction

php joonika app:init

for initial new website

php joonika app:update

update assets for public folder -> publish

structure

after update public your project this structure will be shown

root folders:

config/websites // location of site config > *.yaml
config/SortMiddleWare.php // order of middlewares run -> if not set by folder order
modules/ // modules location

storage folder auto generated by app:update

storage/files
storage/langs
storage/logs
storage/views
modules/ // modules location

in themes folder you can use every theme for multi domain websites

module structure

assets/*     // static assets files for using by theme or Views
Controllers/*     
Traits/*     
src/*     
Views/*

controller methods

you can use two method (post|get)

    public function get_index(){
        
    }
    public function post_index(){
        
    }

calling by url

Example:
GET: localhost/en/sample/inquiry/mobile

this url parse:
localhost: domain
en: language slug
sample: module
inquiry: controller
mobile: method

namespace Modules\sample\Controllers;

class inquiry extends Controller

    public function get_mobile(){
        
    }
}

Controller Available Methods

Permission Check

$this->hasPermission('users');

Validate Check

$this->validate(['q|required,min:10,max:11']);

Available Methods:

required

max:(value) (Ex: max:10)

min:(value) (Ex: min:10)

Response

Success

this->setResponseSuccess($data,$success=true);
// you can response success as false in 200 (http status success)
{
    "success": true,
    "data": [
        
    ]
}

Error

this->setResponseError($alert,$exit=false,$code=null);
// $alert text can be string or array
// if(array)
$alert = [
    "message"=>"sample message",
    "source"=>"sample message", // where happend -> file path or controller name or field name
    "data"=>"sample message", // string or array
];
// if you want to exit code and not continue after
// you can change http status code else 200
{
    "success": false,
    "errors": [
        {"message":"sample message"}
    ]
}

###TWIG