Beginner Question: Define PHP "framework" for me

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

Threaded View

I've just grabbed a PHP book and can deal with the syntax and now I
need to decide to learn specific packages and features.  

Define "framework".  

What are the major framework flavors ?  

Under what conditions can I use two or more frameworks?

Sorry for the beginners question.  

a d y k e s @ p a n i x . c o m  

Don't blame me. I voted for Gore.

Re: Beginner Question: Define PHP "framework" for me

Look in the index on the back of the book there probably is something
that refers to "framework" if that truly was something the book was
covering ...instead of trying to get your course studies problems
solved by us.

As to your question, blackmail can incorporate two frameworks
incrimination and photographic.

Re: Beginner Question: Define PHP "framework" for me


Quoted text here. Click to load it

A frame work is a set of classes that can be used to perform the more  
mundane manipulations of the data in your application.

The stuff on could be considered a framework of  
sorts.  There are bunches of classes that provide some utility and  
abstraction of different processing.

For example, PEAR DB lets you use the same code to interact with  
multiple types of databases.  So instead of coding mysql_query() and  
pg_query() in your app, you simply instance an object of class DB,  
define the database type and connection via the DSN and use the _same_  
methods in the class to interact with _whatever_ database it is.  In  
short, your app user can use any database supported by PEAR DB without  
modifying the code (SQL excepted - that is more a database level thing  
than a PHP thing.)

I recently wrote some code that lets me take in user input in an  
Unsafe(), SafeSQL(), or SafeHTMLSQL() manner in PHP/PostgreSQL E-Zine  
Issue 2 Source code ( ).  It takes into account  
sourcing from _POST, _GET, _SERVER, etc.

If I want something from what the user entered, I do:


$IO = new ObjSafeIO;

// Protect from SQL Injection
$FirstName = $IO->SafeSQL("FirstName");  


// Protect from SQL Injection / Cross scripting attacks
$FirstName = $IO->SafeHTMLSQL ("FirstName");  

The class searches across the _POST, _GET, etc for an entry of FirstName  
and then applies the manipulations to it to make it safe for SQL use and  
for display on a web based app... or not safe depending on what I want  
to use the value for.

Hope this helps explain things.

Re: Beginner Question: Define PHP "framework" for me

Scott Auge wrote:

Quoted text here. Click to load it

Dunno about a 'frame work' but a framework is more loosely defined than
that. It's merely a library of code and data structures and typically some
rules about how to use them which make developing applications easier and
more consistent. Really the term is rather mis-applied in PHP since it
refers to a system which you embed your own code into (rather than a set of
functions/classes accessed bound together by your code).

Mixing 'frameworks' is obviously inappropriate given the more correct
definition. The approach taken by most PHP framework developers should make
it possible to mix and match however most try to comprehensive so there
will be a lot of overlap. PEAR (which I don't think describes itself as a
framework) could be used with other libraries.

Frameworks typicaaly provide facitilities for
- templating
- navigation
- access control
- database abstraction



Re: Beginner Question: Define PHP "framework" for me


Quoted text here. Click to load it

Oh yea, here is some code that uses the DB framework and the IO  
framework I was telling you about in another message on this thread.

There is nothing like reading code to learn what to do:

(and I am sure others will be able to tell you what I did wrong in the  
code :P )

Re: Beginner Question: Define PHP "framework" for me

Quoted text here. Click to load it

"Framework" is the same as "Infrastructure" and is sometimes referred to as  
"glue code" or "plumbing". After a programmer develops a component he simply  
plugs it into the framework and it's ready to go. A framework typically  
supplies the following:
- a logon mechanism
- a method of defining and displaying menus so that the user can decide  
which component to execute.
- a method of defining which user is allowed to access which component  
(access control)
- a method of passing parameters between one component and another

There may also be additional features such as:
- an audit logging system
- a workflow system

A framework should be totally application independent. In other words it has  
no knowledge of any particular type of application as that is the  
responsibility of the application components.

Think of how the term "infrastructure" applies in the physical world. This  
describes a system of roads, power supplies, water and sewage systems,  
communication systems etc. If you build a house within an area where such an  
infrastructure exists then you have something of value. On the other hand if  
you build a house in an area where there is no infrastructure - no roads, no  
power, no water, no sewage, no communications - then you have an enormous  
amount of work to do before it becomes inhabitable.

Once you develop a good infrastructure/framework you should be able to  
re-use it time and time again for many different applications. This means  
that you can spend more of your valuable time on coding the business rules  
and less time on the plumbing.

Tony Marston

Re: Beginner Question: Define PHP "framework" for me

Quoted text here. Click to load it

Thanks, everyone.  I was looking for something more formal and not
finding it.  Now I see why.

a d y k e s @ p a n i x . c o m  

Don't blame me. I voted for Gore.

Site Timeline