SysFrm QuickStart:

SysFrm is an Application Development Framework developed by bdinfosys for HostBilling ( A software for Web Hosting Businesses). SysFrm aims to make the development process a pleasing one for the developer without sacrificing application functionality. Sysfrm is accessible, yet powerful, providing powerful tools needed for large, robust Business applications.

Sysfrm is right for you if:

— You need exceptional performance
— You need to make large robust enterprise applications
— You need to use simple Closures to respond to requests to your application
— You need expressive, elegant syntax
— You need very best solution from what you have already seen

We have developed HostBilling using SysFrm Application Framework. Let’s show you how our application works.
Before we go next step, let’s create a small database driven example application. Assuming that, you already installed HostBilling in your local or remote server.

Go to <Your Application Directory> /apps/handlers/
create a file inside this directory named hello.php
In this file write this content-

Let’s say we have installed hostbilling in hostbilling directory in our localhost
Now browse this url –
http://localhost/hostbilling/index.php?_route=hello
You should see the output – hello world.

Now delete previous content and write this-

Refresh the browser and it will show the default country based on Application Settings from HostBilling Admin Panel.
How it work’s- with this one line of code, it makes query in appconfig database table and return the data from this.
Now check the appconfig table using phpMyAdmin or any other tools, you will see a list of data used for application configarations.
You can query any of the value using this function. (e.g. – lc(‘CompanyName’) will show your company name, lc(‘caddress’) will show your company address, lc(‘sysUrl’) will show your application url etc.)

Other Common used readymade functions:

== Function _get
This will grab the data from ‘Get’ method and make it safer for use
Example: echo _get(‘pid’);

== Function _post
This will grab the data from post method Form and make it safer for use
Example: For example let’s say we have a form with post method and in this form we have a text field. e.g.- <input type=”text” name=”username”/>
We can grab this data for this input using this function. e.g. $username = _post(‘username’);

== Function r2($to)
This function will redirect to another url with optional you can set the message and message type (e.g. error message, success message)
Example: Delete other code in hello.php and write this code-

Now browse this url –
http://localhost/hostbilling/index.php?_route=hello
And you will be redirected to google.com
Now let’s show in real world usage-
r2(APP_URL . ‘/a.php?_route=admin/dashboard’, ‘s’, ‘Hi, you have just redirected to dashboard with this success message’);
in first parameter we put url, in second parameter ‘s’ means Success message, you can put ‘e’ for error message. In third parameter you can put the message that will be displayed in next page.

== Function _raid(10)
With this function you can generate random number.

Every time you refresh the page, this will generate new random code.
More example: _raid(‘6’) // will generate 6 digit random number. You can use any number here.

== Function _encode($text);
This function will encode any text. This is two way encryption, encoded text can be decoded again. We will show this in next function.

This will return something like this- NTM0OGJiNjY2YTUwZmhlbGxvIHdvcmxk
This is the encoded text, you can decode with this method- _decode(‘NTM0OGJiNjY2YTUwZmhlbGxvIHdvcmxk’) and this will return – ‘hello world’
You will be wonder that, every time you encode a text will return new unique encoded text but when you decode this the result will be same. This is important to make this text to unique in our application

All this common usage function is available inside the file AppINIT.php in root folder.
Now you understand how it works.

SysFrm ORM:
Database is the heart of every big application. To interact with the database sysfrm brings to you a powerful yet readable and simple ORM.
in hello.php write this code-

Now refresh the url. You will be shown all your client emails.

Let’s say we have a client with this email id- razib@bdinfosys.com. Now Write this code in hello.php

With this example, you can retrieve single records from database

Example Usage:
Here is the some sample code from our application hostbilling.
Querying: 
Single recordes: 
$cmd = _post(‘cmd’);
$d = ORM::for_table(‘accounts’)->find_one($cmd);  //$cmd is client id here.

Multiple records: Check the first example for SysFrm ORM

Where method: Check second example.

Updating data to database:

Deleting data from database:

Inserting data to database:
here is the example code from the file cpanel.php inside handlers folder-

Tempting:
In sysfrm, you can use any function offers smarty template engine. Smarty template engine is high performance and fast template engine used by some big commercial softwares.
By default smarty will initialize in your application with sysfrm autoloader. We have modified smarty for this. So, it’s ready to use.
in your hello.php file write this code-
$smarty->display(‘hello.tpl’);

Now refresh the page to see the result.
Edit the contents hello.tpl inside ui/theme/c/bmsapp to check how it works.

Class Autoloading:
You do not need to use include, require to initialize a class. Make your class file and sysfrm will do the rest.

in your hello.php file write this code-
For example write this code  inside hello.php – Hello::txt(‘Razib’); this will return Hello Razib!
Here is the contents for Hello.php file inside apps/sysfrm folder:

 

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter message.