Friday, 23 August 2013

PHP frameworks: are they all singletons and bad?

PHP frameworks: are they all singletons and bad?

Sometimes I do find myself confused by the answers and advice by the
programmers/ developers in stackoverflow here.
For instance, there are programmers/ developers say that singleton/ global
programming is bad.
answer 1 answer 2
But I find that many PHP frameworks practise singletons/ globals, for
instance, Magento, Zend Framework, and Laravel.
For example from Laravel,
DB::insert('insert into users (id, name) values (?, ?)', array(1, 'Dayle'));
This seems clear to me that it is a singleton approach.
I want to pick up a PHP framework but then I am held back by -
'singletons/ globals are bad'. So what/ which php frameworks should I/ you
use? If all php frameworks are using singletons , then why there are still
so many developer go for a PHP framework.

No comments:

Post a Comment