Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Antonella's avatar

ArgumentCountError Too few arguments to function Illuminate\Support\Str::replaceFirst()

i have composer 1.10.20

there is a new error that I don't understand, related to how I recall the livewire view in the laravel view.

i get this error:

ArgumentCountError Too few arguments to function Illuminate\Support\Str::replaceFirst(), 2 passed in /Users/gianmarx/hoqu-laravel/vendor/livewire/livewire/src/helpers.php on line 12 and exactly 3 expected (View: /Users/gianmarx/hoqu-laravel/resources/views/dashboard.blade.php)

I recall the livewire view like this:

        @livewire('menu-dash-board')

and I get the above error

if I comment the page works

0 likes
7 replies
Tray2's avatar

Show the code for dashboard.blade.php

You use the Str helper and you pass only two parameters to it, you need to pass three.

Str::replaceFirst(),

You need to pass the string you want to replace, the string you want to replace it and the string you want it replaced in.

$replaced = Str::replaceFirst('the', 'a', 'the quick brown fox jumps over the lazy dog');
Antonella's avatar

i solved with:

composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear

thanks all the same for the support @tray2

7 likes
da_Mask's avatar

php artisan config:clear in particular.

ComparisonTr@p's avatar

same issue happen to me when i just install livewire and run

php artisan make:livewire component

than throw error

Too few arguments to function Illuminate\Support\Str::finish(), 1 passed in C:\playground\movie-app\vendor\livewire\livewire\src\helpers.php on line 12 and exactly 2 expected

after clear cache, config, view than its ok

samir_maharjan's avatar

Too few arguments to function Illuminate\Support\Str::studly(), 0 passed in /Users/samirmaharjan/Desktop/Codeilo/vendor/livewire/livewire/src/helpers.php on line 13 and exactly 1 expected. when i try to upload a file ti this file input it is showing me error I tried all the above solutions but not working

Please or to participate in this conversation.