1

I am working on a project and tried to install firebase package using:

composer require kreait/laravel-firebase

But it returns different errors:

Using version ^4.1 for kreait/laravel-firebase
./composer.json has been updated
Running composer update kreait/laravel-firebase
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - lcobucci/jwt[4.1.5, ..., 4.2.x-dev] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
    - kreait/laravel-firebase 4.1.0 requires kreait/firebase-php ^6.0 -> satisfiable by kreait/firebase-php[6.0.0, ..., 6.x-dev].
    - kreait/firebase-php[6.0.0, ..., 6.x-dev] require lcobucci/jwt ^4.1 -> satisfiable by lcobucci/jwt[4.1.0, ..., 4.2.x-dev].
    - Root composer.json requires kreait/laravel-firebase ^4.1 -> satisfiable by kreait/laravel-firebase[4.1.0].

To enable extensions, verify that they are enabled in your .ini files:
    - D:\xampp\php\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-sodium` to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require kreait/laravel-firebase:*" to figure out if any version is installable, or "composer require kreait/laravel-firebase:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

How can i fix this problem?. Is there any solution for this?

Hammad Butt
  • 73
  • 2
  • 7
  • Did you try the solutions offered by that error message itself? "_require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension._" – brombeer Mar 14 '22 at 10:36
  • use `sudo apt install php-sodium` for linux for xampp, uncomment extension=php_sodium.dll in php.ini – bhucho Mar 14 '22 at 10:38

3 Answers3

4

For me, I just follow this steps.

step 1.

At first, You need to install/activate sodium goto D:\xampp\php\ and open file php.ini.

Now search for sodium

You will see ;extension=sodium

Remove semi colon ; and save file.

Now reload apache, and run the composer again.

Step 2.

Delete composer.lock file

composer require kreait/laravel-firebase --with-all-dependencies

the kaal
  • 41
  • 1
  • 1
3

You need to install/activate sodium goto, D:\xampp\php\ and open file php.ini.

Now search for sodium

You will see ;extension=sodium

Remove semi colon ; and save file.

Now reload apache, and run the composer again.

Murad Ali
  • 347
  • 2
  • 15
0

The answer by Murad Ali worked for me. The only change was I accessed the php.ini file via Xamp the windows app. To edit go to config then select php.ini from the list and edit from there. Scroll to Line 953

the php.ini file xamp server screen and