Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Kohana extended, transparently :)

I have started working on a project which uses both Kohana and Zend Framework. I use Kohana for low level system structure (e.g. MVC) and Zend Framework for higher level components.

What I wanted to do is to create a framework on top of these two great open source frameworks, this way building applications will be a lot easier in the future because I will have all the basic (and advanced) functionalities ready to go. :) In a nutshell, the framework will act as a ‘middle-man’ layer.

One of the goals of my framework is to act as transparent as possible. This means, the user can simply drop the framework at a convenient location, place a hook file in Kohana add it as a normal Kohana module, and that’s it! Let the magic begins!

One major achievement for me today is how I made the framework absolutely transparent. Normally this is how you extend a Kohana library or helper:

class valid extends valid_Core {}

Thanks to Kohana’s cascading file system, it will automatically start looking for ‘valid_Core’ in the modules and system directories.

Now, I wanted to add my framework, and assume my framework has an enhanced version of valid_Core, and I want to use that, what do I do? See below:

class valid extends valid_Core {}

That’s right, it is *exactly* the same syntax as before! You don’t have to alter your existing application in anyway to take advantage of more libraries and helpers. :)

And of course if the library or helper isn’t present in my framework, it will automatically fall back to the Kohana one. And if for some reason you don’t like the enhanced version, you can easily disable them. :)

That’s it for today. In the next few days I’m going to play with the new Kohana unit test library (only available in the SVN repository for now). I wonder how it compares to SimpleTest and PHPUnit.

P.S. The name of my framework is called ‘Layerful’, I will release it in open source license once it’s mature enough. :)

  • Digg
  • DZone
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , , , ,

Comments Section

4 Responses to “Kohana extended, transparently :)”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 2

    great!let`s know more details about your framework ‘Layerful’after it`s ready..

  2. 3

    You did a great job!
    You did this is what i want to do it for.

  3. 4

    Hi Fred, any repositories to have a look at the code?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>