views:

7296

answers:

16

I have long been a fan of _why's Camping microframework -- lightweight, great for microscopic applications (low concurrency, easy to use and edit and maintain), which is what I do. I'd love to know if there's something similar for PHP; full-blown app frameworks like CakePHP or Symphony are very large for what I do, but I can't seem to find nothing "less".

What PHP framework would you prefer, in this situation?

+10  A: 

The most light weight php framework that I am aware of is Code Igniter, which is pretty good, but still much bigger than camping. However, implementing a very simple MVC type pattern in php is pretty easy and there are a ton of articles on the web about it. For example:

And that is just what I found with a few minutes of googling. Of course, for most small php apps, you don't really need this type of stuff. You can just hack to together a single page of script and html, all in one file. Not very clean, but it gets the job done (usually... sigh).

Paul Wicks
Kohana wins over Codeigniter anyday
Niteriter
+3  A: 

I'm a recent CodeIgniter user myself, I like it a lot.

If you want to see real-world code that's not very difficult, you can check out this:

http://hippohx.googlecode.com/svn/trunk/src/tools/web/

Which is the source code of this website:

http://hippohx.com

Zárate
Agreed. I liked using CodeIgniter, and it's very small (a single ./system/ folder). It's also a far less "rigid" framework, so if you need to throw a web-interface around some code you already have, it shouldn't require too much change.
dbr
+2  A: 

What's wrong with using full-blown app framework even for tiny tasks? They all are pretty lightweight and modular, so you can just skip unneeded modules. As all frameworks I know use lazy loading these modules will not be included at runtime.

Also, there are several advantages of using existing framework:

  • Applications tend to grow over time. At some point you may painfully realize that the custom framework is somewhat limiting to further development.
  • Programmers come, programmers go. Maintaining application based on popular framework may reduce initial learning curve cost when hiring new developer.
  • Costless upgrade. You don't need to invest a penny to get your framework upgraded to newer version.
Michał Rudnicki
+1  A: 

I am currently using the Zend Framework as my framework-of-choice. The various components are as loosely coupled as possible, allowing for you to use as much or as little as you like. Essentially, the Zend Framework is not full stack but provides you with the components to rapidly build your application with more control over the components you use (or choose to include in your app).

Kieran.

Kieran Hall
+1  A: 

i like codeigniter too. And We are waiting for new version of the CMS ExpressionEngine to run on top of it.

CI is nice as it lets you take or leave how much you use or even use it with Zend Framwork for example so you do not have to change you style too much.

ontangent
+8  A: 

Kohana is a lightweight fork of CI. I like it better, but decide for yourself.

David
+1 for Kohana... you should be using PHP5!
alex
+4  A: 

If you want a super lightweight PHP framework, check out LightVC. CodeIgniter looks like a bloated hog in comparison.

LightVC does not include a model component, (hence the "VC" part), however you can grab your own ORM tool like CoughPHP or Propel. CoughPHP is written by the same guy who writes LightVC, and they compliment each other extremely well.

I've been using LightVC on some of my recent projects and did some benchmarking. It's no secret that CodeIgniter smokes most other PHP frameworks. Well, LightVC smokes CodeIgniter.

Keep in mind though, LightVC is super lightweight. You're not going to get any helpers or modules with it. It's literally a view-controller framework and that's it. Nothing else.

Bob Somers
That should read "LightVC does _not_ include a model component". Someone with edit privileges should fix that.
anshul
Thanks, good catch. Fixed.
Bob Somers
+7  A: 

The lightest PHP framework I've used is Nice Dog, which tries to be very much like Camping, at least in spirit.

One that's slightly heavier, and has a steeper learning curve, but is incredibly fun and useful once you get it, is Konstrukt.

Neither of these include an ORM, but if you need one, I really like Doctrine. I had not seen CoughPHP before this thread, but it looks decent, and definitely lighter-weight than Doctrine.

Clinton R. Nixon
Nice Dog is out.
Alix Axel
Nice Dog has been put down. May he rest in peace.
Pekka
using doctrine or propel on a lightweight framework is overkill. it's like building a skyscraper on stilts.
stillstanding
A: 

TinyMVC seems to be very very lightweight. I haven't actually tried it. It's PHP 5 only though.

Thorpe Obazee
A: 

From this question:


I made this one for my own personal use, it consists of only 4 functions:

  • DB()
  • Route()
  • Singleton()
  • View()

It's inspired by NiceDog and DiBi. I use it primarily for simple websites and APIs, and I find the DB() function quite useful because it's quite easy to implement (zero configuration) and supports all the following features:

  • SQLite 3
  • Arrays for SELECTs
  • Last Insert ID for INSERTs
  • # of Affected Rows for UPDATEs, DELETEs, ...
  • Prepared Statements and Escaping similar to DiBi

I haven't written any documentation for this but it should be pretty easy to understand if you study the code for a couple of minutes.

PS: I only use this "framework" for test cases and sometimes for low traffic stuff, a full featured framework should be used if you're doing something serious.

Alix Axel
A: 

Obullo is a super lightweight php framework that derived from Code Igniter.

It use CI Active Record Class with PDO.

Look at develturk.com

Ersin
+5  A: 

I'm not sure what qualifies as "lightweight". The PHP Fat-Free Framework is only 55KB uncompressed. In that puny size they crammed a Ruby Sinatra-like routing/controller, template engine, CAPTCHA generator, HTML forms processor, URL-based cache and SQL handler.

This is the next best thing to Nice Dog
stillstanding
A: 

There are many metrics of what "lightweight" can possibly mean: disk size on server, amount of code generated for the client, difficulty of installing / configuring process on the server, etc...

I've been on the core development team of a PHP Framework called NOLOH for 6 years now, and I believe that NOLOH scores remarkably high on all those meanings of lightweight. NOLOH's benefits are too numerous to just quickly review here, but we believe that it makes developing and maintaining a website or webapp of any size or complexity orders of magnitude simpler than other solutions.

Yet what distinguishes NOLOH, as far as "lightweight" is concerned, is that NOLOH will automatically figure out what is and is not used by the particular project, and lazy-load only the necessary modules, while also sending the client only the necessary code for his current view only. We describe this aspect as being "on-demand." Many other frameworks either include far too much (commonly found in fat client frameworks) or leave it to the developer to surgically include what he needs. NOLOH handles this, and countless other hassles, for you completely transparently and automatically. In short, it lets you just focus on the application logic without the countless implementation tricks and details.

Check out http://www.noloh.com

Philip Ross
+1  A: 

I like Flourish

RyanWilcox
+1  A: 

http://github.com/jim/fitzgerald...

anon
A: 

micro-mvc and tweet-mvc are tiny.

Xeoncross