Author Topic: What is a PHP framework and how do they work?  (Read 1134 times)

0 Members and 1 Guest are viewing this topic.

Offline Bman900Topic starter

  • Enthusiast
  • Posts: 177
    • View Profile
What is a PHP framework and how do they work?
« on: April 16, 2010, 06:59:31 PM »
So I tried searching this on google and it only got me more confused. Can some one explain what a PHP framework is and how it effects a PHP developer?

Basicly is it a way you write code or is it a giant script where you built off of from? Sorry for the extremly stupid questions but am just curious.

Offline andrewgauger

  • Devotee
  • Posts: 600
  • Gender: Male
  • Failure is a step on the road to success
    • View Profile
    • Resume
Re: What is a PHP framework and how do they work?
« Reply #1 on: April 16, 2010, 09:42:46 PM »
http://framework.zend.com/about/overview

It is essentially a collection of features not included in the native distribution.  People write open source contributions to the framework and everyone is welcome to use it.   
PHP 5.3.2 | Apache 2.2.14 | MySQL 5.1.41 | Ubuntu 10.04
Developers of the modern age get no respect.  We are always the blunt of jokes, the first to blame, and people hardly talk to us.  I wouldn't trade it for the world.

Offline Bman900Topic starter

  • Enthusiast
  • Posts: 177
    • View Profile
Re: What is a PHP framework and how do they work?
« Reply #2 on: April 16, 2010, 11:24:38 PM »
Ok, so I found a nice sideshows that helps you set up the framework but from what I see you need to mess with php.ini some root server stuff and mod_rewrite. Is this framework able to be run on a shared host or must have a dedicated server?

Offline andrewgauger

  • Devotee
  • Posts: 600
  • Gender: Male
  • Failure is a step on the road to success
    • View Profile
    • Resume
Re: What is a PHP framework and how do they work?
« Reply #3 on: April 16, 2010, 11:31:17 PM »
PHP 5.3.2 | Apache 2.2.14 | MySQL 5.1.41 | Ubuntu 10.04
Developers of the modern age get no respect.  We are always the blunt of jokes, the first to blame, and people hardly talk to us.  I wouldn't trade it for the world.

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: What is a PHP framework and how do they work?
« Reply #4 on: April 17, 2010, 12:52:52 AM »
Quote
Is this framework able to be run on a shared host or must have a dedicated server?

You should have no problem using Zend framework on shared hosting. You will need the ability to write .htaccess files though (which all Apache hosting should provide).

Offline Zyx

  • Enthusiast
  • Posts: 127
  • Gender: Male
    • View Profile
    • Invenzzia open-source group
Re: What is a PHP framework and how do they work?
« Reply #5 on: April 17, 2010, 05:21:18 PM »
When you make a web application, you usually don't do (or at least - you shouldn't do) everything from scratch. Some parts of the code are very similar across the application, and you can see that you write many things in a very similar way. If you take this "shared" code and design concepts you are using and make a reusable library from it, you get a framework. Then you can put it into your new project and speed up it, because many parts are already done and ready to use. Of course, most of such home-made frameworks will simply suck, especially if you have no experience, but technically speaking they are still frameworks.

The idea of "professional" frameworks is similar, but of course they are well-designed, well-tested, flexible and provide lots of features for different purposes. They give you pieces of a complete code, tools, automatic code generators and some techniques and you build a web application using them, just like building a house from ready bricks.

PS. I would not recommend Zend Framework if you are a beginner. It's quite complex and requires much more from the programmer to set up the basic application structure.
My open-source projects:
Open Power Template - template engine for PHP
TypeFriendly - documentation and user manual builder

Offline Bman900Topic starter

  • Enthusiast
  • Posts: 177
    • View Profile
Re: What is a PHP framework and how do they work?
« Reply #6 on: April 18, 2010, 09:24:47 AM »

PS. I would not recommend Zend Framework if you are a beginner. It's quite complex and requires much more from the programmer to set up the basic application structure.

Man I wish you were here 2 days ago cause I tried Zend and I only got more confused and mad cause I had no idea what I was doing. I was always writing everything from scratch before so I have no experience in any framework. What framework would you recommend?

Offline Zyx

  • Enthusiast
  • Posts: 127
  • Gender: Male
    • View Profile
    • Invenzzia open-source group
Re: What is a PHP framework and how do they work?
« Reply #7 on: April 18, 2010, 03:25:58 PM »
What is your experience with object-oriented programming and design patterns? Actually, it's quite hard to say which framework is easy and which is not. People have different preferences and it simply depends. Note that many people would recommend you the framework they use, but they may be professionals and write from their point of view. However, I'll try to describe you something...

Kohana is relatively simple, but it has very poor documentation and tutorials which may be a problem. Yii Framework has quite a lot features, but I think it is also quite easy for the beginners. It comes with the ready-to-use application skeleton and code generators that generate the basic, primitive web application which you simply have to fill with your content. Unless you try to make sophisticated hacks, it should be OK.

Anyway, before you start, read something about design patterns and MVC (Model-View-Controller), becuase these techniques are very popular in frameworks and will help you understand, what's going on. Just a small note here that most of the frameworks does not actually implement MVC (even if they write they do), but something called MVP (Model-View-Presenter), so don't be confused if you will find differences between practice and theory, like I was for two years :).
My open-source projects:
Open Power Template - template engine for PHP
TypeFriendly - documentation and user manual builder

Offline TeddyKiller

  • Devotee
  • Posts: 1,055
  • Gender: Male
  • What is today without tomorrow or yesterday?
    • View Profile
Re: What is a PHP framework and how do they work?
« Reply #8 on: April 18, 2010, 05:44:12 PM »

PS. I would not recommend Zend Framework if you are a beginner. It's quite complex and requires much more from the programmer to set up the basic application structure.

Man I wish you were here 2 days ago cause I tried Zend and I only got more confused and mad cause I had no idea what I was doing. I was always writing everything from scratch before so I have no experience in any framework. What framework would you recommend?

I'm not touching any frameworks at all for atleast another year.
Please use [code][/code] and [php][/php] when posting code.

Please use proper PHP opening tags. <?php code here ?>

If I have posted false information, feel free to correct me.

Offline dotMoe

  • Irregular
  • Posts: 14
  • Gender: Male
  • ... coming to a server near you ...
    • View Profile
    • dotMoe
Re: What is a PHP framework and how do they work?
« Reply #9 on: April 19, 2010, 02:34:24 AM »
I learned to design websites without the use of Frameworks back in the day; but as I learned more, and did more sites; I ended up having a respository of classes that I would need; and essential classes, that made my life as a coder easier.  I then tried cakePHP and other frameworks, figuring out that; throught out my years of programing, i ended up creating my own personal framework that hasn't failed me yet :)

Frameworks make coding somewhat a little faster for the traditional coder, and can prove to be quite efficient. 
For example I am currently working on a site that is built of a Moodle Build.  Within their framework they have the function get_records($table, $searchfield, $serachvalue, [$limit]);

which takes care of querying the database, returning the value, and then run a foreach on all the rows, and returns them into an object.

Its saves me ton of time and I dont have to repeat the same code over and over again.