Download the PHP package chkn/core without Composer
On this page you can find all versions of the php package chkn/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package core
CHKN3
PHP Framework for developing lightweight server-side application.
Installation
- Download the package using composer.
composer create-project chkn/core folder_name
- Install Application Key
php chkn key:generate
- Change the rootfolder of the app. It must be the name of your main folder.
php chkn root folder_name
- Database Configuration
- Changing Database Connection =
php chkn db:connection __Connection__
- Changing Database Host =
php chkn db:host __host__
- Changing Database Name =
php chkn db:name __name__
- Changing Database Charset =
php chkn db:charset __charset__
- Changing Database Username =
php chkn db:username __username__
- Changing Database Password =
php chkn db:password __password__
- Changing Database Connection =
- Run the application
php chkn roast
- `php chkn roast --port=8000
Package
Default classes on CHKN Framework are grouped and compiled inside Drive:ROOT_FOLDER/config/Package/package.conf
-
Query Building Class - Set value to 0 to disable
-
Encryption and Decryption Class - Set value to 0 to disable
-
Download Class - Set value to 0 to disable
-
Upload Class - Set value to 0 to disable
-
Session Class - Set value to 0 to disable
-
Maintenance Class - Set value to 0 to disable
-
Page Not Found Class - Display a Page Not Found Page if class or method was not found. Set value to 0 to disable
- CSRF Token Class - Set value to 0 to disable
Vendor Styles and Scripts
Include a global styles and scripts on the application.
-
Include Global CSS - Go to
config/vendors/stylesheet.conf
- Include Global Scripts - Go to
config/vendors/scripts.conf
CONTROLLERS AND PAGES
As what we know about Controllers, they are the one actually responsible on what must be displayed inside a View and what must be requested inside the Model. In CHKN Framework , Controllers are the most important file on your system. Controller is the place where you have to declare what will be your template to be use, the page that will display inside your template, the page title, the page stylesheet and scripts and the place where you will becreating a request in the Model.
Creating a Controller
- You have to create a PHP file inside the folder Http/Controller/. The File name must be the name of the Controller you want, followed by the word Controller. Example: homeController.php
- php create:controller __controller_name__
Every Controller will contain the following codes.
- scene("template","page content") - Calling the the page template. 'index' is pertaining the the template file located at view/template/index.tpl
- ->title() - Set the title of the page.
- ->css() - Including stylesheets inside the page. CSS Files are stored at public/css.
- ->js() - Including scripts inside the page. Script Files are stored at public/js.
- ->show() - Compile the settings above and display the page.
Routing
In CHKN Framework, navigating to a page means navigating to a Controller. As you created a page you must also create a Controller that will hold all the request or processes of that page
Navigation through Links
Most of the times, links are most likely use when navigating from one page to another. Exactly what you can do in CHKN . On creating link location you must follow the exact format. [chkn:path]controllerName/methodName
Templating Tool
Passing values to your template
Data processed by controller can be pass inside your template using the variable() chain method of the scene() function.
Passing array on your template
Array processed by controller can be pass inside your template using the $this-> array_var() method.
Populating assigned array on your template using foreach
Assigned array variable on the Controller can be populated using the CHKN Framework Templating Tool. Developers can use the foreach as shown below.
Note: You can address the specific field on the array by enclosing the field name by {[ ]}
The if Condition
You can also set a conditional statement out of the assigned variables.
The For Loop
You can easily create a looping statement such as FOR LOOP in CHKN Framework using its Templating Tool. Take note that Comparison Operator to be used must be enclosed with square bracket []
Forms and CSRF Token
Including csrf field on forms will enable a CSRF token for every form request. This will tighten the security against CSRF or Cross-Site Request Forgery.
Fetching Request
QUERY BUILDER
On CHKN Framework, Database operations such as Create, Read, Update and Delete are handle using the QUERY BUILDER. Add the Class DB on your Controller Class
Select Query
On CHKN Query Builder, Select Operation is executed using DB::select()
;
Select All
Select By Table Field
Select with JOIN
Select with Limit
Select By Order
Insert Query
On CHKN Query Builder, Insert Operation is executed using DB::insert()
;
INSERT
Delete Query
On CHKN Query Builder, Delete Operation is executed using DB::delete()
;
DELETE
Update Query
On CHKN Query Builder, Update Operation is executed using DB::update()
;
UPDATE
Query
On CHKN Query Builder, You can create your own query using DB::query()
;
QUERY
Sessions
The functions session_start()
is already included in the framework's core. All the functions for handling Session are included in the class Session.
Saving Session
For saving session, use the method put().
Deleting Session
For deleting session, use the method clear().
Reading stored Sessions
For reading stored sessions, use the method get().
Checking if Session exists
For checking the session's existence, use the method check().
Helpers
Helpers are functions added to the core of PHP Framework to help you speed and homogenise repetitive tasks on development.
Encryption and Decryption
Encrypting and Decrypting String in the Controller
-
Encrypt
- Decrypt
Dump and Die
PHP Debugging using CHKN Framework Dump and Die.
Upload File
Upload Files on your application
Download File
Upload Files on your application
Redirect Page
Redirect from one page to another
JSON Response
Throw a JSON Response on an HTTP Request
Modules
In CHKN Framework, you can define objects globally thru Modules. The App's Modules are located and can be created inside http/Module
folder. CHKN Modules works like an ordinary Controller, but you can access it any existing Controllers inside http/Controllers
Auth Controller
Generate an authentication page in the Application.
php chkn auth:create
Auth Class
Access authentication session using the Auth Class.
Auth::check(array,redirect)
Trigger authentication checking in selected method in a class using the Auth::check() function
Check method access with multiple roles