Search code examples
phpcodeignitercodeigniter-4faker

Can't install fzaninotto/faker in Codeigniter 4.3.1


I'm trying to install faker in my Codeigniter project , but I got the following error

  Problem 1
    - fakerphp/faker v1.21.0 conflicts with fzaninotto/faker v1.5.0.
    - fzaninotto/faker[v1.6.0, ..., v1.9.2] require php ^5.3.3 || ^7.0 -> your php version (8.0.9) does not satisfy that requirement.
    - fakerphp/faker is locked to version v1.21.0 and an update of this package was not requested.
    - Root composer.json requires fzaninotto/faker * -> satisfiable by fzaninotto/faker[v1.0.0, ..., v1.9.2].

I've tried running composer update and re-running composer require fzaninotto/faker but I still got the same error. What can I do to fix this? Thanks


Solution

  • Solution:

    Uninstall/remove fzaninotto/faker from your composer.json file since it isn't compatible with your current PHP version (8.0.9) and was abandoned already.

    By default, Codeigniter 4 comes with an up-to-date and well-maintained improved alternative (fakerphp/faker) pre-installed/configured.

    Reference(s):

    fzaninotto/faker This package is abandoned and no longer maintained. No replacement package was suggested.

    Generating Test Data

    Often you will need sample data for your application to run its tests. The Fabricator class uses fzaninotto’s Faker to turn models into generators of random data.

    FakerPHP

    Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.