Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
开发者_StackOverflow中文版Closed 8 years ago.
Improve this questionI have a moderately simple assignment, to create a PHP/PDO site with login functionality and article retrieve/save/edit/search. No tags, nothing else.
Is this overkill to use some framework for this? It it a good decision to use custom code + perhaps template system like Smarty for a simple site that will not grow too much?
Is there a software niche/best practices for small sites? In a nutshell, I need logins/forms, but aren't frameworks like Zend or Cake too much for this?
I think that you can never go wrong by adding a framework to any size project. Anytime you can reuse something (and not reinvent the wheel) or leverage an existing code base to speed application development time, then do it.
Besides, you never know when your small to mid-size project suddenly grows to a large project. At least then you will have the pieces in place to grow your application and not have to start from scratch.
I'm a big fan of CodeIgniter, it would make setting up a simple website like this pretty painless. There is a fairly extensive stackoverflow answer about authentication libraries for CodeIgniter which would make login a breeze.
I would not suggest using a third party template library such as smarty. CodeIgniter has helper functions which can be used within 'views' which will allow you to do a lot of things quickly and painlessly, such as form creation.
I think using a framework is ideal for simple projects. They're quicker to set up and get going with. A framework may not be ideal if you need to fine tune how the site will run for reasons such as scalability or special requirements, or because you just don't like frameworks.
I'd suggest just using whatever parts of the Zend Framework you feel you need. Zend is very 'pick and choose' friendly.
That said, I recently used the ZF Application (MVC collection) for a two page site, just because it made things so easy. You don't need to have multiple controllers/models/view helpers to justify using a MVC framework.
Please don't user smarty. It's really unnecessary. PHP is it's own template language.
These posts on sitepoint tell the story well: #1, #2, #3
I've been using Kohana and I like it.
http://www.kohanaphp.com/
This guide got me started Kohana 101
For something that simple you can use a tiny framework like MicroMVC which comes with a equally small PDO based ActiveRecord-like database class.
精彩评论