PHP code example of chrisharrison / case-converter

1. Go to this page and download the library: Download chrisharrison/case-converter 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/ */

    

chrisharrison / case-converter example snippets


final class SomethingThatNeedsToConvertCase
{
  private $caseConverter;
  private $defaultSuffix;
  
  public function __construct(CaseConverter $caseConverter, string $defaultSuffix)
  {
    $this->caseConverter = $caseConverter;
    $this->defaultSuffix = $defaultSuffix;
  }
  
  public function usesTheConverter(string $aStringFromSomethingElse): string
  {
    $this->caseConverter->from($aStringFromSomethingElse)->toCamel() . $this->defaultSuffix;
  }
}