PHP code example of sentgine / helper

1. Go to this page and download the library: Download sentgine/helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sentgine / helper example snippets


use Sentgine\Helper\Word;

// Create a new instance of Word
$word = Word::of('hello world');

// Convert to PascalCase
$result = $word->pascalCase();
// Output: HelloWorld
echo $result;

// Convert to kebab-case
$result = $word->kebabCase();
// Output: hello-world
echo $result;

// Convert to snake_case
$result = $word->snakeCase();
// Output: hello_world
echo $result;

// Convert to camelCase
$result = $word->camelCase();
// Output: helloWorld
echo $result;

// Convert to Title Case
$result = $word->titleCase();
// Output: Hello World
echo $result;

// Sample method chaining
$result = Word::of('hello world')
    ->pascalCase() // Convert to PascalCase
    ->kebabCase()  // Convert to kebab-case
    ->snakeCase()  // Convert to snake_case
    ->camelCase()  // Convert to camelCase
    ->titleCase(); // Convert to Title Case

// Output: Hello World
echo $result;