Showing posts with label kohana. Show all posts
Showing posts with label kohana. Show all posts

Tuesday, December 22, 2009

Introduction To KohanaPHP - Article for packtpub UK

Recently I was contacted by one of the editors at www.packtpub.com, to come up with an article on programming with Kohana PHP Framework www.kohanaphp.com. I was happy getting such an offer and also happy because I will get to see how good my technology writing skills are ;), to me its some sort of a test. I came up with the article after a couple of days and for my first time, I say I am impressed because my first draft was approved and was said to be ok for publishing.
Oh well personally I was thinking I will have to do a second and third draft before it gets approved.
below is a preview of the article followed by a link to packtpub.com where the article is published... check it out and tell me what you think....merci.

Overview

Kohana PHP Framework is an open source PHP software development framework that helps php developers to build web applications faster, and also, more effectively by providing them with a set of built-in objects/classes. It also enforces highly organized coding standards.

The Kohana PHP Framework is just like Ruby on Rails; it implements the well known software engineering design pattern—Model View Controller(MVC). The Model View Controller software design pattern guides engineers to design their software codes into three separate parts which includes:

  • Models: The objects that manipulate data sources and data stores.
  • Views: The html and css files with inline php codes that present the user interface and controls to the application users.
  • Controllers: Objects in charge of the business logic, displaying the page(views), and routing the click actions from the views to the model and back to the views....

Monday, June 08, 2009

I Love Kohana PHP Framework – My New Found Love

Kohana is not only my new found love when building applications with php, its also rock solid MVC (Model View Controller) Object Oriented Framework for php developers.
Just like the .NET Framework and Java SDK, Kohana can be referred to as some sort of SDK for php developers, it brings a lot of order into php codes which have been referred to as spaghetti codes for years .
With Kohana php or other php frameworks like Codeigniter, you can build your application with objects just like in Java and any other developer who knows how to use the framework will easily follow your code without asking you questions. if you ever wanted to use php in a team environment, I will ask you to consider Kohana due to the following reasons:

True Object Oriented:
Everything in Kohana SDK is an object, the helpers are objects with static methods, the libraries are all objects and you can create your own classes/objects, the views are objects (which is strange but programming wise very interesting), and of course the controllers and Models are all objects.
In other frameworks, I had never wanted to create controllers and extend them but in Kohana I realized that sometimes I have to build some ABSTRACT CONTROLLERS (I feel am back in Java), and then extends these controllers in the various sections of my website. For instance there is a Template Controller that helps developers using Kohana easily create master templates for their pages.

Best ORM in PHP:
ORM or object relational mapping is a technology where in you can map your database tables and their relationships in objects (Models) and then instantiate those models and call functions to get the data without writing SQL. In Kohana, I find ORM very easy to use and fun. Before ORM in Kohana, I tried ORM in Cakephp and Codeigniter but they all proved to be buggy or were too difficult to comprehend.

Templating made easy:
Templating is something most web developers in Africa will have to consider, it makes your life easy as a developer and makes the life of designers you work with super easy. In Kohana you create a single template.php file which can constitute the site's logo, navigation, sidebar and footer. Then fit in some variables that will change from control function to control function. This way my web apps all have one master template and just small view files that I set as variables. It makes my life easy to edit and also to change the design of the whole site in minutes. Check out the templating in Kohana at www.kohanaphp.com and you will be amazed

I8n aka internationalization:
Before Kohana I had to figure out how to hack Codeigniter to do internationalization but with Kohana, everything that appears on the screen as text you can use the i8n folder found in application/i8n and make sure you have text in every language possible. Coming from Cameroon, just like Canada we have french and english as official languages which means most of my apps have to be internationalized from day one.

PHPDOC and Code Hints, Code Completion:
In Kohana, since everything is an object, it simple means using phpdoc very well and a good IDE like Netbeans 6.5, you will get code hints and completion for both in build Kohana libraries, helpers, other classes and your own built classes. I use Netbeans 6.5 and when I code, I get a lot of speed reading the code hints and getting code completion for the functions in every helper or object I want to use. It makes my life easy and I just feel I am coding using .NET C# or Java. But other than Visual Studio, and like Eclipse, Netbeans is free and its light weight (in terms of memory consumption) and easy to install and configure to coding with php.

Those are some of the reasons I think I will go with Kohana.
Another question is:
why use php at all?
Well php is cheap for me and the server I have bought runs only php and most of my clients don't care which technology we use so we go with php. Hey with php I get to train and employ talents in the space of 6months, something I cant do with .NET or Java.

What do you think about Kohana php ?