1. Go to this page and download the library: Download karaca-tech/string-mask 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/ */
karaca-tech / string-mask example snippets
use KaracaTech\StringMask\Facades\Mask;
mask('John Doe')->keepFirstAndLastCharacter()->apply(); // J******e
Mask::fullname('John Doe'); // J*** D**
Mask::initials('John Doe'); // J.D.
// Let's spice things up a little bit
Mask::of('John Doe')
->silent()
->eachWord()
->keepFirstWord()
->keepFirstCharacter()
->then(fn(Masker $masked) => $masked->append('.'))
->apply(); // John D.
use KaracaTech\StringMask\Powder\Processor;
use KaracaTech\StringMask\MaskTarget;
class MyProcessor extends Processor
{
public function execute(MaskTarget $string): string
{
// Do your magic here
}
}
// or
class ProcessorWithParams extends Processor
{
public function __construct(private AnotherClass $anotherClass)
{
}
public function execute(MaskTarget $string): string
{
// Do your magic here
}
}
Mask::of('John Doe')
->using(MyProcessor::class)
->using(MyOtherProcessor::class)
->using(ProcessorWithParams::class, new AnotherClass())
->apply();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.