Closed willdurand closed 12 years ago
Yeah, not sure about that. The factory will work if you add an autoloaded Provider. But I'm not sure I'll add Yet Another Autoloader - or a dependency to PSR-0 autoloader.
You should avoid require()
methods too.
And a PSR-0 autoloader is a standard, I guess you want to follow conventions for this lib :)
Le 15 oct. 2011 à 14:15, Francois Zaninottoreply@reply.github.com a écrit :
Yeah, not sure about that. The factory will work if you add an autoloaded Provider. But I'm not sure I'll add Yet Another Autoloader - or a dependency to PSR-0 autoloader.
Reply to this email directly or view it on GitHub: https://github.com/fzaninotto/Faker/issues/5#issuecomment-2415259
Why should I avoid require()? Not way to to otherwise if I don't want to use an autoloader.
A PSR-0 autoloader is a dependency. For now, this project has none, and therefore is very easy to install. I'd like to keep that.
Besides, there are a lot of good libs that don't feel obliged to use an autoloader. See, for instance:
https://github.com/fabpot/yaml
2011/10/15 William DURAND < reply@reply.github.com>
You should avoid
require()
methods too. And a PSR-0 autoloader is a standard, I guess you want to follow conventions for this lib :)Le 15 oct. 2011 14:15, Francois Zaninottoreply@reply.github.com a crit :
Yeah, not sure about that. The factory will work if you add an autoloaded Provider. But I'm not sure I'll add Yet Another Autoloader - or a dependency to PSR-0 autoloader.
Reply to this email directly or view it on GitHub: https://github.com/fzaninotto/Faker/issues/5#issuecomment-2415259
Reply to this email directly or view it on GitHub: https://github.com/fzaninotto/Faker/issues/5#issuecomment-2415796
+1 for this.. I can't use this in my Symfony2 application because you don't have the "Faker" directory inside the src/ dir.
Btw, the fabpot/yaml library is made for PHP 5.2 not 5.3
So now we have a standard directory structure. But do we need an autoloader?
If you want to avoid require
and add use
instead, probably yes. Otherwise no but I don't know if it will work fine.
We already use use
. And the Factory has some sort of autoloading for Providers with a cascade to default locale, that an autoloader won't allow. So I think we don't need a PSR-0 autoloader, and I think Faker works fine in projects that already have an autoloader.
I'll wait for more feedback, but I'll probably close this one.
Mmmmh I meant to avoid this kind of statement: https://github.com/fzaninotto/Faker/blob/master/src/Faker/Factory.php#L5
Yes, I got you loud and clear. But require
isn't a bad word per se. There, requires allow any developer to start using the library without installing a third-party autoloader - right away.
Why not add a small autoload.php file (like the autoload function in https://wiki.php.net/rfc/splclassloader) for people that doesn't use an autoloader or use a not PSR-0 compatible autoloader ?
It could be a compromise beetween the requires and the dependency to an autoloader...
Fixed by #13
\o/
Hi,
What about adding an autoloader for this lib ? And to set a "standard" directory structure as below:
That will follow the PSR-0 standard and will ease integration in other projects. You won't have to provide a dependency with ClassLoader except for unit test or standalone usage (which is more or less the same thing).
See: https://github.com/knplabs/Gaufrette Note: Propel2 will follow the same standard.