Thin PHP Frameworks

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Can anyone recommend to me a thin PHP framework? By thin, I mean that I
don't want a massive amount of code, dependencies, or large learning
curve. I'm also not thrilled about introducing XSLT into the project --
I'm not a fan of that. However, I'd like to use something that helps me
abstract the application logic and presentation layer a little better.
And if there's something that helps me display prettier HTML forms, or
a seperate package, that's icing on the cake.

Re: Thin PHP Frameworks

i developed my own system.  it isn't too difficult.

1. you have a main logic page.
2. the logic page includes a template page or redirects to itself on
form submission.

3. i have a file where i store constants and the like.
4. i link to a style sheet.

in order to help out, i use Manuel Lemos' forms generation and
validation class (  the class is awsome.  it isn't
simple to learn, but nothing powerful is.

i also use the adodb abstraction layer to do my db work.  i'm quite
happy there, too.

only your imagination can limit your css (presentation).

i highly recommend visiting's css forum - paul is a css
guru.  if you try and make cross browser compatibility a reality, css
guru's are your friend.  your best friend.

i use postgresql - great db with a license much better than mysql.

if you *really* want to go with a framework, you may want to look into
ruby on rails.  lots of java and php developers are saying it is a
great way to develop.

of course, you lose some capability for the simplicity, but that can
often be made up by adding the complexity back in, where appropriate.

good luck.

Re: Thin PHP Frameworks

btw, here is a link to some basic css layouts / effects that you can
build upong:

these were developed by paul who hangs out at the forum i
linked to earlier.

good luck.

Re: Thin PHP Frameworks wrote:
Quoted text here. Click to load it
horde: 17935 KB, depends on PEAR and several php extensions
phpPeanuts: 762 KB, no dependencies, but still quite a learning curve

Quoted text here. Click to load it

Try a pattern!

For example if myScript.php contains:

     <TITLE>My Page</TITLE>
     <?php include('') ?>

this will output the content coming from file '' on the  
location of <?php include('') ?>. Now i guess you can do  
this kind of thing too with JSP. But there is an important difference:
the code from the included file is executed inside the function it is  
included from. In the example there is no function, but in the following  
example there is:

in 'myScript.php':

     $page = new MyPage();

in 'MyPage.class.php':


class MyPage {

     function service() {

     function printTitle() {
     print "My Page";

     function printBodyPart() {
     $part = new MyBodyPart();

in '':

     <TITLE><? $this->printTitle() ?></TITLE>
     <?php $this->printBodyPart() ?>

in 'MyBodyPart.class.php':

class MyBodyPart {

     function service() {

     function printMessage() {
     print "Hello World";

in '':

<B><?php $this->printMessage() ?></B>

Becuase the skin files are included inside methods, the $this variable  
will reference the object whose method includes the skin. This way we get:
- separation of layout and OOP code,
- pages composed from reusable parts
And all this without a framework, without a template engine, all you  
need is to follow a simple pattern!

For abstracting application logic:
Give each database table a primary key 'id', make it auto_increment.
Made a class DbObject. Make a subclass of DbObject for each database  
table. Make one instance for each record. You can load it from the  
database with php's msql_fetch_object() function. Use getter and setter  
methods. Wite a delete() method on DbObject that deletes using 'id' column.

Write a save() method for each class. Or better, use "SHOW COLUMNS FROM  
$tableName" to write a generic function that writes a value for each  
column. If $this->id is not set it must be a new object, do insert. If  
it is set, do update.

Write all application logic that is not specific to the user interface  
in these DbObject subclasses. The user interface should only access data  
through instances of these classes.


Henk Verhoeven, (includes the above patterns and more).

BTW, in investment in knowledge is the best investment you can make.  
Knowledge is more flexible then any framework can ever be and lasts  
longer too. If a framework helps you te learn how to make better  
software that makes the framework only more valuable.

Site Timeline