php-isocodes icon indicating copy to clipboard operation
php-isocodes copied to clipboard

Class "Sokil\IsoCodes\IsoCodesFactory" not found

Open hashimaziz1 opened this issue 1 year ago • 3 comments

Got this error in my XAMPP dev environment after running:

composer require --dev sokil/php-isocodes-db-only

And calling the library with the following code from the docs:

$isoCodes = new \Sokil\IsoCodes\IsoCodesFactory();
$country = $isoCodes->getCountries()->getByAlpha2('UA');

Any idea why this is?

hashimaziz1 avatar Jan 08 '24 19:01 hashimaziz1

Library sokil/php-isocodes-db-only does not require sokil/php-isocodes where class \Sokil\IsoCodes\IsoCodesFactory stored.

Install both library and required files explicitely as described in documentation:

Installation

To install "sokil/php-isocodes" library with full database and i18n files:

composer require sokil/php-isocodes sokil/php-isocodes-db-i18n

You may also install "sokil/php-isocodes" with only database (no i18n will be available):

composer require sokil/php-isocodes sokil/php-isocodes-db-only

sokil avatar Jan 10 '24 10:01 sokil

I see, so you need both php-isocodes and php-isocodes-db-only to use the library without localisation? This should probably be made clearer in the documentation, as currently it looks like you only need sokil/php-isocodes for "manual database installation and updates".

hashimaziz1 avatar Jan 11 '24 19:01 hashimaziz1

yes, i can't remember now why i made this? but you need to install both lib and db )

php-isocodes - contains php code php-isocodes-db-only - contains only json files, and does not require php-isocodes

so i think i need to remember why i do this and update docs :) or i will add library as dependency.

sokil avatar Jan 11 '24 19:01 sokil