Giter Site home page Giter Site logo

Adding an autoloader about faker HOT 13 CLOSED

fzaninotto avatar fzaninotto commented on August 17, 2024
Adding an autoloader

from faker.

Comments (13)

fzaninotto avatar fzaninotto commented on August 17, 2024

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.

from faker.

willdurand avatar willdurand commented on August 17, 2024

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 [email protected] 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:
#5 (comment)

from faker.

fzaninotto avatar fzaninotto commented on August 17, 2024

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 <
[email protected]>

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 [email protected] 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:
#5 (comment)

Reply to this email directly or view it on GitHub:
#5 (comment)

from faker.

ruudk avatar ruudk commented on August 17, 2024

+1 for this.. I can't use this in my Symfony2 application because you don't have the "Faker" directory inside the src/ dir.

from faker.

ruudk avatar ruudk commented on August 17, 2024

Btw, the fabpot/yaml library is made for PHP 5.2 not 5.3

from faker.

fzaninotto avatar fzaninotto commented on August 17, 2024

So now we have a standard directory structure. But do we need an autoloader?

from faker.

willdurand avatar willdurand commented on August 17, 2024

If you want to avoid require and add use instead, probably yes. Otherwise no but I don't know if it will work fine.

from faker.

fzaninotto avatar fzaninotto commented on August 17, 2024

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.

from faker.

willdurand avatar willdurand commented on August 17, 2024

Mmmmh I meant to avoid this kind of statement: https://github.com/fzaninotto/Faker/blob/master/src/Faker/Factory.php#L5

from faker.

fzaninotto avatar fzaninotto commented on August 17, 2024

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.

from faker.

yohang avatar yohang commented on August 17, 2024

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...

from faker.

fzaninotto avatar fzaninotto commented on August 17, 2024

Fixed by #13

from faker.

willdurand avatar willdurand commented on August 17, 2024

\o/

from faker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.