PHERN - The stupid MVC


I once had a job interview and the man asked if I had built any MVC's on my own; so phern was born. In 20 lines of PHP. All other configs, headers and scripts are non essential. In fact this very page needs nothing but the 20 lines that compose the PHERN core.

But there is more to it... here's a demo.


PHERN is so easy its just plain dumb... In fact the config file is not even necessary! (It does help though).

It comes with a MySQL plugin, to illustrate the data tier. But it doesn't need that ether.


  • Upload PHERN to your desired directoy.

  • Optional:

    • Rename config/boot-sample.php to config/boot.php and add your database details.

  • Start adding to the mvc/ directory!

    • Copy the mvc/demo folder and rename it to something else.

    • Next rename demo-model.php, demo-view.php and demo-controller.php to something else.

    • Thats it! Edit away at your new MVC setup.


Wait? Feature? Yes. Feature. As far as I can tell PHERN has one cool thing about it: You can concatenate the URL dividers (the default is "/" because I like htaccess), but you can use anything you want.

For Example:

A mvc/user and a mvc/pasword folder can be called in the URL like /user/password and all the functionalities of mvc/user will be inherited by mvc/pasword instantly.

You could keep going, add a mvc/reset and you could call a URL like /user/password/reset.

Also, there is no moral obligation to put any controllers or views or models in an mvc folder.

One more thing...

It might not be a feature, but its nice that all of it, every single bit of PHERN except those 20 lines are plugins. So you can include a zillion billion plugins in your boot file and they will all come together nicely on your application.


  • Why is it stupid?

    It's a way of saying that there is not much too it. Because there really isn't.

  • So you built this 20 line MVC on a job interview grudge?

    Hell yeah.

  • Why PHERN? Why not PHLOWER? Or PHICUS?

    Fern + PHP = PHERN, you probably got that part. Also a fern has those fractal like leaves, like the way you can concatenate tier functionality in PHERN.