Laravel str snake() function Example

Admin   Laravel   150  2021-03-15 13:10:06

Hi Guys,

In this blog,I will you how to use laravel str snake() function example. We will show example of snake function in laravel.the str::snake method converts the given string to snake_case.

Here, I will give you full example for simply str snake() method in laravel as bellow.




namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Controllers\FileController;

use Illuminate\Support\Str;

class HomeController extends Controller



* Show the application dashboard.


* @return \Illuminate\Contracts\Support\Renderable


public function index()


$converted1 = Str::snake('fooBar');


// output - foo_bar

$converted2 = Str::snake('niceBlog');









It Will help you...