Topic: 10 projects every php developer should use (Read 80993 times)
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5707
45899 credits Members referred : 3
« on: Nov 09, 2007, 12:50:35 pm »
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
OMG!I am geek
Gender:
Posts: 57
370 credits Members referred : 0
« Reply #4 on: Nov 10, 2007, 08:23:45 am »
Thanks, Nik! This list came just on perfect time for me
Community Supporter?
World Wide Whale
Gender:
Posts: 160
1052 credits Members referred : 1
« Reply #5 on: Nov 10, 2007, 10:42:43 pm »
Thanks for sharing
Bill Cosby is my Father
Gender:
Posts: 4
24 credits Members referred : 0
www.garlisch.net
« Reply #6 on: Nov 10, 2007, 11:26:03 pm »
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!!
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5707
45899 credits Members referred : 3
« Reply #7 on: Nov 10, 2007, 11:29:27 pm »
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.
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« Reply #8 on: Nov 11, 2007, 12:39:19 am »
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.
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5707
45899 credits Members referred : 3
« Reply #9 on: Nov 11, 2007, 12:52:25 am »
Yeah working with the API directly can be a big pain in the ***
Bill Cosby is my Father
Gender:
Posts: 4
24 credits Members referred : 0
www.garlisch.net
« Reply #10 on: Nov 11, 2007, 02:45:49 am »
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!
I am just looking for feedback as to why PHP as a template engine is a good or bad idea.
thanks again!
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #11 on: Nov 11, 2007, 10:56:29 am »
@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 am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5707
45899 credits Members referred : 3
« Reply #12 on: Nov 11, 2007, 11:28:53 am »
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.
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« Reply #14 on: Nov 11, 2007, 06:58:04 pm »
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.
Bill Cosby is my Father
Gender:
Posts: 4
24 credits Members referred : 0
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.
Bill Cosby is my Father
Gender:
Posts: 4
24 credits Members referred : 0
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
Just another rainy day
Posts: 1
6 credits Members referred : 0
« Reply #17 on: Nov 20, 2007, 02:05:13 pm »
Well half of the stuff such as email, RSS or user auth is included in Zend Framework
Zend Framework is salvation for PHP world
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
Just another rainy day
Posts: 1
6 credits Members referred : 0
« Reply #19 on: Nov 20, 2007, 10:13:26 pm »
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.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7333