Screen Shot 2021 03 22 at 9.35.13 PM

How To Convert Any Laravel 9 String Into Pascal Case String

Laravel 9 String Support library gives us opportunity to use it in different ways and achieve many feats with unique methods. We have mentioned the conversion of any string into Pascal Case String in Laravel 9.

Raw string: store products count

Pascal Case String: StoreProductsCount

Laravel 9 Str support library shows us how we can manipulate strings in unique ways with examples.  We can simply convert any string to Pascal Case using studly() function. Please see below the code we have done for you to understand it. This code also works in Laravel 9.0.


namespace App\Http\Controllers;

use Illuminate\Support\Str;

class HomeController extends Controller {
	 * Show the application dashboard.
	 * @return \Illuminate\Contracts\Support\Renderable
	public function index() {
		$str = 'store products count';
		$converted = Str::studly($str);
		echo $converted;

Please check Laravel 9.0 docs for detailed documentation. If you have any problem just leave a comment in comments section. We will answer it.