What size of PHP project do people think "i really need a framework for this"...
Take this code:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$dbname = 'test';
$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Cannot connect to mysql server");
mysql_select_db($dbname) or die("Cannot select database");
$delete_item_id = mysql_real_escape_string($_POST['id']);
$result = mysql_query("delete from `timesheet` where id ='".$delete_item_id."'")
or die(mysql_error());
?>
This would take 5 minutes to write by hand in Notepad++, surely a framwork would be overkill for this script!
Or do people who use frameworks...always use frameworks?
Using a PHP framework cuts down development time, because frameworks automate several tasks. With a framework, a PHP developer can automate common tasks like authentication, session management, caching and URL mapping.
Wikipedia lists 40 PHP frameworks, but some of those are better described as content management systems, and undoubtedly there are many more. Early PHP frameworks include PHPlib, Horde, and Pear.
I stand in a very different place than most people on this issue.
The size of the project is irrelevant. The size of the team and all future teams is what is important.
A framework, regardless of what you've been told, will slow down development if you are a quality programmer. What you gain from a framework are way more important than that. Firstly, you'll create more maintainable code. Secondly, you'll create more standardized code. Lastly, you'll create more segregated code.
All of these things only matter, with the possible exception of the first one, to teams.
If you are a solo dev, and you know what you are doing, you can spring up the core bits of frameworky doodads you need very quickly. You can maintain a personal library of classes and functions that you come back to all the time, and you can decide what you need for each project as you need it.
You are right, something small that only needs to take 5 min to make, should just take that 5 min to make. Take my silly little Genetic Algo Funny Image Generator at http://www.twitterandom.info/GAFunny/ which is little more than a couple database tables, some directories, and one page. But with a bunch of really hardcore classes to do all the GA work.
How would a framework have made that project easier or better? It wouldn't have. Yet it IS a reasonably complex project.
Turn the table. What if I were building that with a team and we needed to all work on it at the same time? What if the plan was for me to stop working on it a year from now and 10 other people would need to pick up where I left off?
Then a formal framework becomes vital. That is where using something standard, in this case something like smarty or symphony, would really make finding new programmers to work on it easier.
That is where a framework becomes a requirement. With a team. And the larger the team, and more often it turns over, the more important it becomes.
You need a framework (no matter if existing or self-made) as soon as either of those is true:
Yes, short one-shot scripts don't need a framework, but as soon as it gets more complex you need one, even if you write one yourself (i recommend to use any existing framework though, as you can then hire people who already know it which reduces the effort to train them on your code)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With