PHP code example of savinmikhail / primitive_wrappers

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

    

savinmikhail / primitive_wrappers example snippets


use Mikhail\PrimitiveWrappers\Str;

// Create a string wrapper
$str = new Str('Hello, world!');

// Get the length of the string
$length = $str->length();

// Use methods as a builder
$lowercaseCapitalized = $str->toLower()->capitalize();

//use some more advanced methods
$snake = (new Str('Lorem ipsum dolor sit amet'))->snake(); //lorem_ipsum_dolor_sit_amet