PHP code example of cline / babel

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

    

cline / babel example snippets


use Cline\Babel\Babel;

// Convert to ASCII with transliteration
Babel::from('Żółć')->toAscii();           // "Zolc"
Babel::from('北京')->toAscii();            // "bei jing"
Babel::from('Привет')->toAscii();          // "Privet"

// Detect scripts
Babel::from('Hello 世界')->containsChinese();   // true
Babel::from('Привет мир')->containsCyrillic();  // true
Babel::from('مرحبا')->isRtl();                  // true

// Clean strings
Babel::from("Hello\x00World")->removeNonPrintable()->value();  // "HelloWorld"
Babel::from('Hello 👋')->removeEmoji()->value();                // "Hello "

// Create slugs
Babel::from('Héllo Wörld!')->toSlug();  // "hello-world"