PHP Framework Design With Hierarchical M PDF
PHP Framework Design With Hierarchical M PDF
CONTROLLER ARCHITECTURE
Ahmad1, Zainal Arifin2, Dyna Marisa Khairina3
Computer Science Department, Mathematics and Natural Science Faculty Mulawarman University Samarinda 1,2,3
[email protected], [email protected], [email protected]
Abstract
The development of internet today makes website as the most popular information system media. Among several
programming languages that can be used to build a website, PHP is the open source web-programming language and
very popular among any programmers. Web building method from time to time also has its progress. From the
beginning using the conventional method raises some obstacles, until finally evolved to the use of the framework that
has many advantages in terms of management and library files. The framework has been widely spread on the internet
that can be used to create a website, especially for users of PHP today. Among the many frameworks, architectures
used affect the effectiveness of the use of the framework. The purpose of this research is to design a PHP framework
that implements the architecture of the Hierarchical Model-View-Controller (HMVC) system which was originally
developed for desktop applications. HMVC is an architecture that consists of a layer of MVC (Model-View-Controller)
that has a derivative relationship hierarchically. The final results is the form of a PHP application framework with
HMVC architecture which results in a system that can help make large-scale websites and worked as a team.
Keywords: PHP, Framework, Website, Hierarchical Model-View-Controller (HMVC).
process. System controller will execute the modules Routes = Explode(‘/’, URI)
Jml_Rute = Count(Rute)
True Module = URI
that have been determined by the routing part. The Tmp_Mod = null
Prev_Mod = null
Params = Array()
Module = “index”
module are the model, view and controller. The module True Last_Part = UcFirst(LastPart(‘/’, Module);
must have a controller, but it does not necessarily have Module = Routes[i]
Tmp_Mod += Routes[i] + “/”
True
i=0
Route = Module + “/” + Action
Function = “action” + UcFirst(Action)
Class = “Djokka\Controllers\” + Last_Part
to that support part. Thus, the system controller only Prev_Mod += Routes[i] + “/” i=0
False
runs part of the supporting required course. If there is Module += “/” + Routes[i]
Prev_Mod += “modules/” + Routes[i] + “/”
If the module executed has model calling process, Figure 3 Flowchart Forming HMVC Architecture
then the part that handles it is system model. In web
application, model can be used for validation or 4.4 Rule of System
accessing database. If a model is used for validation, As framework, there is a rule used to give scope to
then system can run supporting part namely Validation. user in order not to split or out of rule. Those rules
If model needs database connection, then system model include as system design. Rules that have been decided
with the database driver help will open database to be followed in framework are:
connection and give the access. Data from database will a. Rule of module manufacture
be fed back to database driver then to system model and b. Rule of sub-module manufacture
get fed back again to system controller. From system c. Rule of controller module manufacture
controller then data will be continued to model d. Rule of action function manufacture
accessed by module controller. e. Rule of view manufacture
Output resulted from system controller is an web f. Rule of model manufacture
content information and the list of web asset needed by
a module. Web asset is client-script file, like JavaScript 4.5 System Interface Implementation
file and CSS. That information will be continued to Error handler is error message that will be
system view for further processed. With the DOM displayed by system when it is found error experienced
HTML help, system view will run rendering, so that it when web project execution. Error message displayed
results HTML document output. DOM standing for is designed in such a way in order that web programmer
Document Object Model is library that is actually can repair error experienced. Term of this error
available in any web browser. But now it is also correction is called debugging. Figure 4 shows error
available in PHP. Output resulted from rendering message display along trace faults.
process is HTML document that will be received by
web browser to be displayed next.
Part of system applying HMVC architecture is
called HMVC engine, it is an engine used to collect the
information of a module according to HMVC
architecture. That information can be used by system
determining module location that will be executed.
Figure 3, shows flowchart forming HMVC architecture