Sublime directory Surf the web anonymous Pagerank Monitor


10 projects every php developer should use

Nikolas
Fri 9 November 2007, 11:50 am GMT +0100



As a php web developer, you should know that php is probably the language that has the biggest code repository. So no matter what module you want to include in your project there should be an open source solution.

This can help in various ways, but just in case you can't think of one, here I put a few :
  • Open source is worked by many people, so the result is for sure better than one man's work
  • You can have free updates to your code, while otherwise you should code the updates each time something new comes up
  • You save development time while your project is getting better

Anyway, after many years as a web developer, I've compiled a list of php classes that can be easily integrated in any project and I am regularly use.

Sending Emails

Sending emails is something very common for every web site. Php's mail() function is good for this, but what if you want to attach a file, or send through an SMTP server, etc? Well in that case you should use phpmailer

User Manipulation

Another common module is the user module. With that you can manipulate users (login, logout, register, etc.) Personally I've never found a project that is good enough, so I created my own :)

Php user class is a module that can be used even in established projects, as it uses variable data for database tables, fields, session variables, etc.

Fetching RSS Feeds

Ever wanted to fetch an rss feed from your project? Well there is always an easy way to fetch a feed but in most cases you need more than that. When that is the case you should definitely use Magpie RSS

Geotargeting

There are many times that you need to know where are your visitors coming from. Maxmind gives a solution to this. For a complete tutorial check this article

Grabbing Remote Content

Some times RSS is not enough so you need to grab the content of a web page and parse it. If you are a huge fun of preg you should not continue reading, but if you are not you definitely need the htmlSQL class The htmlSQL class allow you to access html values with SQL code. Nice huh? :)

Trackback

Sending and receiving trackbacks is vital for a web site in our age. And in fact it is very easy if you are using a class like php trackback

Template System

Another thing that all sites use is a template. A template engine can save you lots of time, while it can make display changes very easy. A complete template engine that most projects use is Smarty

BBcode

BBcode used to be a functionality for forums, but as more and more sites use it in order to be more friendly to their users, you might want to use BBcode to your site. The problem is that BBcode requires a lot of coding and I am not sure if you have the time for this. If you don't you'll find StringParser_BBcode class very useful :)

Paypal Payment Integration

As you may know paypal has a nice API for developers who want to integrate paypal payments in their sites. The paypal IPN integration class helps you make use of it and start accepting payments in 20 minutes.

Editor Controls

I don't have a problem to make changes to a site using phpMyAdmin or a simple text area, but when it comes to my clients I have to give them more than that. A javascript WYSIWYG editor is a perfect solution but as it requires countless hours to get it done I would suggest you to use the tinyMCE control

Hope you enjoyed this list. If I forgot something feel free to comment above :)


Mind_nl
Fri 9 November 2007, 12:40 pm GMT +0100
Thats a nice list of classes and I have used most of them before. Can't think of any other good ones at the moment, but if I do I'll add them here.

olaf
Fri 9 November 2007, 12:44 pm GMT +0100
great list Nick, I'm sure I will use some of them in future projects

wineo
Sat 10 November 2007, 01:19 am GMT +0100
Thanks Nik, great list! I am sure I will use some at a later stage too...

droom
Sat 10 November 2007, 07:23 am GMT +0100
Thanks, Nik! This list came just on perfect time for me :)

maverick
Sat 10 November 2007, 09:42 pm GMT +0100
Thanks for sharing :)

dbgarlisch
Sat 10 November 2007, 10:26 pm GMT +0100
Good stuff. I am always looking for more code to "borrow"!   ;)

But, I have a Q of a technical nature...

I have not been able to justify the use of a templating engine (such as smartie) over using PHP itself as the templating engine. It just seems to me that non-PHP templates would be far less efficient than PHP templates.

Can you give me any technical reasons why a templating engine approach is superior to PHP templates? What am I missing here?

thanks!!

Nikolas
Sat 10 November 2007, 10:29 pm GMT +0100
First of all welcome to webdigity dbgarlisch :)

The main reason to have a template engine is that you separate your code from your template. This way you code much more easily, and you can outsource design without problems.

flowover
Sat 10 November 2007, 11:39 pm GMT +0100
I signed up for this forum from digg because of this article.  I hope to see it grow.  The paypal IPN class will definitely be helping me out quite a bit in the future.  Oh the hairs I've pulled trying to work with their API. 

Nikolas
Sat 10 November 2007, 11:52 pm GMT +0100
Yeah working with the API directly can be a big pain in the *** :)

dbgarlisch
Sun 11 November 2007, 01:45 am GMT +0100
Sorry Nikolas, I didn't present my original question very clearly.

I fully understand, and agree with the use of templates to separate back end logic from visual presentation (i.e. MVC pattern).

I was referring to the choice of which templating engine to use. You recommended Smarty in your original post. And, from what I have read and heard, Smarty is a very robust engine!

However, I have been using (in my limited experience) PHP itself as the templating engine. Instead of embedding Smarty syntax in the template files, I just embed PHP code. These links explain this approach very well:
  http://thephppro.com/articles/pte.php  and  http://www.massassi.com/php/articles/template_engines/

I am just looking for feedback as to why PHP as a template engine is a good or bad idea.

thanks again!

olaf
Sun 11 November 2007, 09:56 am GMT +0100
@dbgarlisch

hi and welcome at webdigity.

It's nothing wrong to mix your html with php snippets, a lot of people doing this. The reason to use a real parser is that it will take less server resources. Since php parses the html on the server side php has to do a lot of more work (parsing diff. peaces) while parsing one (bigger) peace of code is a one time action.

I hope that helps ;)

Nikolas
Sun 11 November 2007, 10:28 am GMT +0100
I think dbgarlisch means something different Olaf.

For instance you are creating a mini site that every page has the same template everywhere. In that case Smarty may be too much because you are actually need a template that uses just a few variables with the content your engine creates.

Smarty is better when you have different templates (or pages that use different parts of your template bits) and when you need extra things like caching.

olaf
Sun 11 November 2007, 10:31 am GMT +0100
Nick I answered this question :D

Quote
I am just looking for feedback as to why PHP as a template engine is a good or bad idea.

bugmenot
Sun 11 November 2007, 05:58 pm GMT +0100
One reason you might want to use Smarty rather than just straight PHP is that you can limit how much control the template pages have. If you have someone else writing your templates, this can be helpful. However, if you're coding the templates yourself, I agree that it makes more sense just to use PHP, so long as you are smart about keeping your logic and presentation code separate.

As for sending mail, I've found Swift Mailer to be superior to phpmailer.

dbgarlisch
Mon 12 November 2007, 03:10 am GMT +0100
One reason you might want to use Smarty rather than just straight PHP is that you can limit how much control the template pages have. If you have someone else writing your templates, this can be helpful.

Thanks for the feedback!

I have heard/read this reason before. And I can definitely see the merit if you have "untrusted" 3rd party people creating the templates.

But I have to wonder if the security concern is worth the performance hit?

And I say "performance hit" assuming that Smarty and other template engines are actually more resource intensive than using PHP as the engine? It just seems "obvious" to me that PHP would be more efficient. But my assumption could be wrong!

Has anyone ever done or heard of any performance comparisons between the various template engines including using PHP as the template engine? I have not.

dbgarlisch
Mon 12 November 2007, 03:16 am GMT +0100
Smarty is better when you have different templates (or pages that use different parts of your template bits) and when you need extra things like caching.

Caching is aslo possible using PHP as the template engine. See the CachedTemplate class here

David

techi
Tue 20 November 2007, 01:05 pm GMT +0100
Well half of the stuff such as email, RSS or user auth is included in Zend Framework :)

Zend Framework is salvation for PHP world :)

olaf
Tue 20 November 2007, 01:07 pm GMT +0100
Well half of the stuff such as email, RSS or user auth is included in Zend Framework :)

Zend Framework is salvation for PHP world :)
lol this is great :) (check the blog link bvelow my signature)

cwroblew
Tue 20 November 2007, 09:13 pm GMT +0100
I have not found Smarty to be useful at all.  I use a PEAR module called HTML_Template_IT.  This seems to separate the HTML more from the PHP programs than Smarty so the web designers can do their thing and I can do mine - PHP programming.

pttnores
Fri 30 November 2007, 12:03 am GMT +0100
Thanks Nik, it's an excelent list!
I think you could know and recomend me a good email client so as to integrate with my php framework.

That would save my life because i really needed

Thanks for your time

Petete

codeber
Tue 25 March 2008, 07:48 pm GMT +0100
very interesting read.

i think much of it is a little beyong my level of coding but yeah.  Added to favourites*

karedas
Mon 8 September 2008, 11:23 pm GMT +0200
I should give smarty a try. Seems to be nice template tool.

Ludovic
Sat 3 January 2009, 04:35 pm GMT +0100
Refreshing in PHP page for login it must be error r warning message... can any one give script for php login page...

Nikolas
Wed 7 January 2009, 07:18 pm GMT +0100
Refreshing in PHP page for login it must be error r warning message... can any one give script for php login page...

Check http://phpuserclass.com/

Apice internet
Fri 13 March 2009, 02:16 am GMT +0100
Thanks for sharing

cignusweb
Fri 7 August 2009, 07:38 pm GMT +0200
Thanks Nik. This list is a great use for most of us.

ruskin012
Fri 28 August 2009, 10:53 am GMT +0200
Nice work. These small classes are used by all PHP developer on daily basis. Simple but great collection.


barry100
Sun 20 September 2009, 04:32 pm GMT +0200
great list except for the bb bit. Do people actually use that outside forums ?

lumpersservice
Fri 11 December 2009, 11:52 pm GMT +0100
nice list, Nick. I have use some of the few classes...eventually in the future i can use the others listed on th list...this is really handy...thanks

qforever
Mon 1 February 2010, 04:48 pm GMT +0100
Nice classes. I'm using some of them and will lookout others when it will be needed.
Thanx!
What about AJAX? Any suggestions?

alfredthomson
Tue 29 June 2010, 04:09 pm GMT +0200
php is the best language better than asp.net . open source is the best...

storkclub
Wed 14 July 2010, 09:16 am GMT +0200
Another great list from Nikolas, im new here and he is been very helpfu by giving his insights..i will surely give this list to my webmaster friend with hope it can really help with his work.so far this forum has been helpful to me.keep up the good work

shundamaoyi
Fri 17 September 2010, 10:01 am GMT +0200
 I can totally agree with you on true

JamesWhite
Tue 16 November 2010, 09:36 am GMT +0100
Such a really very well thanks for the sharing this information... i am use this every time...

JamesWhite
Wed 17 November 2010, 11:16 am GMT +0100
I am impress for this information so thanks for the sharing this information...

ashoksharma
Tue 30 November 2010, 08:58 am GMT +0100
really nice list and that is very useful for me as I am looking to know about available modules for php.

vtpp
Mon 20 December 2010, 05:25 pm GMT +0100
Isn't there a PHP cheatlist too? Now this is something I'd love.

healthtourism
Thu 14 April 2011, 06:31 pm GMT +0200
Most important thing, every thing is FREE :)

danielburgas
Fri 22 April 2011, 10:38 am GMT +0200
this helped me a lot

timpane
Wed 3 August 2011, 03:38 pm GMT +0200
f you have somebody additional composing your templates, this can be helpful. However, if you're cipher the templates yourself, I acquiesce that it makes more sense just to use PHP, so long as you are intelligent about holding your reasoning and production cipher separate.

steve19
Wed 17 August 2011, 12:19 pm GMT +0200
Nice Info. Thanks for sharing

Florinda
Fri 26 August 2011, 07:23 am GMT +0200
all very great ideas u r sharing.. thanks.. i like it..

sportzman
Tue 30 August 2011, 10:59 am GMT +0200
thanks for provide me information about this topic

sportzman
Fri 2 September 2011, 06:01 am GMT +0200
Thanks for provide me information about this topic

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional