PHP code example of xtompie / pipe

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

    

xtompie / pipe example snippets




use Xtompie\Pipe\Pipe;

$result = Pipe::new('  <h1>Hello World</h1>  ')
    ->trim()
    ->lower()
    ->ucfirst()
    ->htmlspecialchars()
    ->get();

echo $result;



use Xtompie\Pipe\Pipe;

class CustomPipe extends Pipe
{
    public function reverseAndUpper(): static
    {
        return $this->reverse()->upper();
    }
}

$result = CustomPipe::new('Hello World')
    ->reverseAndUpper()
    ->get();

echo $result;