SartajPHP PHP Framework is very fast and flexible PHP Framework. It uses event driven mechanism on client server architecture. We can easily fire an event on server with hyperlink or ajax request.
<a href="index-detail-2.html">call detail event and pass value 2</a>
Install SartajPHP Framework
With Composer:----
Add to your composer.json:
{
"require": {
"sartajphp/sartajphp": "dev-master"
}
}
Then
composer install
OR
composer update
Here are some features of SartajPHP PHP Framework:-
Application :-
An Application in SartajPHP is a php file where you can write your programming logic and control application html output to browser. Its is center point of SartajPHP PHP. You can create a web application with many applications. Application should be register in registery file otherwise your can not run it. Every application has unique Controller. The Controller is used to create hyperlink or url. You can set Authorisation of application. Every application use $page object of page class. Page Class provide PageEvents of every application which is triggered by URL. You can design application in any style like OOP or simple PHP module. SartajPHP Framework provide free style mechanism.
SartajPhp uses a Gate-Driven Event Architecture (GDEA) where an Application can have multiple Gates, and each browser request is handled by a specific Gate through a Page Event.
Think of it this way:
Application (Your Website)
│
├── Gate: index → handles index.html, index-view-5.html
├── Gate: blog → handles blog.html, blog-search-php.html
├── Gate: admin → handles admin.html, admin-users.html
└── Gate: shop → handles shop.html, shop-products.html
A Gate is the Application's Gate - it allows user requests to enter into specific parts of your application, processes those requests, and sends responses back to the user. One Application can have multiple Gates, each reserved by a unique "request-word" (the gate name in the URL).
Browser Request: blog-view-5.html
↓
Gate: blog (reserved word "blog")
↓
Event: view (maps to page_view())
Parameter: 5 (available via $this->page->evtp)
↓
Output: HTML rendered from Front File + Master File
The URL segment before the first hyphen (or before .html) is the "request-word" that maps to a specific Gate class.
Example of Gate Class with BasicGate for an Web Application:-
<?php
class index extends \Sphp\tools\BasicGate{
public function onstart(){
print "app start<br />";
}
public function page_new(){
print "new event<br />";
}
}
Global Settings :-
Every Web application has its own global settings which can be access in any where in project. You can set here Database,mail settings.
Front File :-
Front file is file where we can use SartajPHP PHP Framework components. SartajPHP PHP Frameowrk has also a component oriented mechanism and it is very powerfull concept to develop a professional web application. If you manage your web content in best way then you can develop a good application. You can create your own component and use it in Front File.
Example of Front File
<alert id="msgerr" runat="server" ></alert>
<div class="heading">Login Form</div>
<form id='form2' runat="server" action="##{ getGateURL('login')}#">
<table align="center"> <tr><td>
User ID </td><td> <input name="txtuserID" type="text" class="inputpass" runat="server"
fui-setForm="form2" fui-setMinLen="4" fui-setRequired="" fui-setMsgName="User ID">
</td></tr> <tr><td>
Password </td><td> <input name="txtpass" type="password" class="inputpass"
runat="server" fui-setForm="form2" fui-setMinLen="4" fui-setRequired=""
fui-setMsgName="Password"> </td></tr> <tr><td>
</td><td>
<input type="submit" value="Login">
</td></tr> </table>
</form>
Requests Per Second: 0
RPS per Thread (56): 0
RPS per Core (28): 0
Web Server handle Web Request in multiple threads to serve more traffic but it depends on machine capacity like CPU,
Memory and Network Speed. So get Accurate value of Framework performance we need to eliminate variable factors. So we use
time to handle one request and Requests handle per seconds per thread. You can
use this tool to calculate one request handling time by any web server.
Use on cmd:- .\request_time_test.exe http://localhost/demo/index.gate
Formula to calculate RPM for CPU from One Req ms = 1000 / OneReqms * 60 * Cores of CPU
| Framework | RPM | RPS/T | One Req ms |
|---|