Kohana PHP App

Kohana

by Kohanaframework

web applications developing HMVC PHP5 framework
Helps with: PHP
Similar to: ThinkPHP App Cloudways PHP SDK App Laravel App Drupal App More...
Source Type: Open
License Types:
BSD
Supported OS:
Languages: Other

What is it all about?

Kohana is a HMVC PHP5 framework that includes a collection of components for building web applications.

Key Features

* Build applications quickly: Many common components are included: translation tools, database access, code profiling, encryption, validation, and more. * Use specific libraries and tools: Extending existing components and adding new libraries is very easy. * Write commercial applications: Uses the BSD license, so you can use and modify it for commercial purposes. * A very fast framework: Benchmarking a framework is hard and rarely reflects the real world, but Kohana is very efficient and carefully optimized for real world usage. * Good debugging and profiling tools: Simple and effective tools help identify and solve performance issues quickly. * Know what the framework is doing: Very well commented code and a simple routing structure makes it easy to understand what is happening. * Work with objects and classes: This is an OOP framework that is extremely DRY. Everything is built using strict PHP 5 classes and objects. * Write your own code: There are no code generators and endless configuration files, so setting up is fast and easy. * Community support: A very active community forum and IRC channel means that most questions are answered very quickly.


Pricing

Yearly
Monthly
Lifetime
Free
Freemium
Trial With Card
Trial No Card
By Quote

Description

free - see site

Product Analysis

PHP

PHP frameworks and libraries

Kohana The swift PHP framework

Kohana The swift PHP framework

By Alvie Amar | 6/1/2016 | Product Analysis |Beginners

Kohana is an elegant HMVC PHP5 framework that provides a rich set of components for building web applications. It is an open source, object oriented MVC web framework built using PHP5 by a team of volunteers whose aims was to create a swift, secure, and lightweight framework. Kohana is licensed under a BSD license, so it can be legally use for any kind of projects. It is known for its superior performance when compared to CodeIgniter.

 

Kohana's development started on May 31, 2007. When version 2.0 was released, Kohana became based purely on PHP 5.0 and a new OOP framework.  As of now, the latest version 3.3.5 was released on March 10, 2016.

 

The main reasons to use Kohana are security, weightlessness and simplicity. On the other hand, Kohana was originally a fork of CodeIgniter, a web framework from EllisLab. There are many similarities between CI and Kohana, but all of the code is either new or completely rewritten.

 

Kohana is known for the following features:

  • Cascading Filesystem
    • Allows for the overriding of anything (properties, methods and even files) in a higher level.
    • Each collection of the directory structure will be independent of others.
  • Scalability
    • Kohana's HMVC file system promises the seamless scalability of the applications.
    • Splitting up the project into modules with least dependency.
  • Easy Configuration
    • Enables the overriding of configurations from a higher level.
    • Configurations can be retrieved using Kohana::config() method.
  • Routing
    • Routes are defined in either application/bootstrap.php or module dir/init.php using the Rout::set() method
    • The routing mechanism will search for the first matching route and the remaining will be ignored.
  • Security
    • Includes tools for XSS removal, input validation, signed cookies, form and HTML generator, to help secure the application.
    • Protection against SQL injection provided by the database layer.
  • Inbuilt modules
    • Modules can be found in Kohana-Modules like database abstraction module, ORM, pagination and etc.
  • Exception handling and profiling
    • Bundled with exception handling that allows for easier debugging.
    • Built-in support for code profiling enables developers to write code efficiently

 

What it is good for?

 

The Kohana framework is typically used to build a web application. You would normally install Kohana and work with that to make a web application. It helps build web applications quickly because it is lightweight and easy to configure.

 

Here are some advantages of Kohana:

  • Kohana’s Application folder has a high level of visibility.
  • Kohana is fast and very simple
  • Kohana does not have a large library like Zend, thus much less to load at start.
  • Kohana is simple to use, easy to set up and configure except for the file path directory structure.
  • Kohana has released much better versions.
  • Kohana has options to integrate with a 3rd party applications like wordpress, joomla and the like.

 

Kohana is a great choice for web development because it is more scalable, lightweight, and the configuration is much simpler than other MVC frameworks—it also has higher security.

 

Some examples and code snippets

 

Let us assume you have already installed Kohana in your working machine and have already done the initial configuration. Let us have a brief overview of Kohana’s Controller and Action.

 

By default the URL format for kohana is http://<base_url>/index.php/<controller>/<action>. So for example http://localhost/kohana/index.php/article/new means it will be looking for article controller (Controller_Article) and execute a new action (action_new()). If action part is empty, index action will be executed.

 

kohana-blog/application/classes/controller/welcome.php

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Welcome extends Controller {

   public function action_index() {

       $this->response->body('hello, world!');

   }

} // End Welcome

Controller_ is the prefix for welcome controller and it extends Controller 

  • action_ is the prefix for an action
  • $this->response->body(‘hello, world!’); sets hello, world! as the response for the request.

 

Now, let us take a look at Kohana’s Model.

Let us assume we are creating an article.php file under application/classes/model as shown below. Our Model_Article object extends ORM. By default it will assume that the table name is just the same name with the model name. For article model, the table name is articles.

 

<?php defined('SYSPATH') or die('No direct script access.');

class Model_Article extends ORM {

//...

}


 Let’s take a look at how to render a view in Kohana

 

kohana-blog/application/views/article/index.php

<?php defined('SYSPATH') or die('No direct script access.'); ?>

<h1>Kohana Blog Homepage</h1>

 

  • Modify the Controller_Article's method action_index() as below to load the view

 

kohana-blog/application/classes/controller/article.php

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Article extends Controller {

   public function action_index() {

       $view = new View('article/index'); // loads the 'article/index.php' file under 'application/view' folder

       $this->response->body($view); // render the  view as response

   }

}

Conclusion 

 

In some ways Kohana resembles CodeIgniter. Kohana's developers took the cool aspects of CI, made them better while removing most of the buggy parts. Kohana is fast and easy to learn. However Kohana has a major drawback which is the complete opposite scenario when compared to Laravel. Kohana’s community is small, elite and somewhat noncontributing. There is also no wide range of proper documentation. Kohana is one of the easiest frameworks to learn, however it lacks support and does not have a very large or active community.

By Alvie Amar | 6/1/2016 | Product Analysis

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
1490
Ronan McCarthy
Cross-Platform & Web developer.
Web | Mobile and 6 more
View Profile
User photo
1230
Gary Green
Expert programmer, Ask what you want
Web | JavaScript and 3 more
View Profile
User photo
1130
Harry Gold
Experienced Web developer.
Web | JavaScript and 3 more
View Profile
Show All

Interested in becoming a DiscoverSDK Expert? Learn more

X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now