1. Go to this page and download the library: Download darling/php-text-types 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/ */
darling / php-text-types example snippets
Darling\PHPTextTypes\classes\strings\classes\strings\Text;
$text = new Text('Foo bar baz.');
echo $text;
// example output: Foo bar baz.
echo strval($text->length());
// example output: 12
echo ($text->contains($text) ? 'True' : 'False');
// example output: True
echo ($text->contains('Foo') ? 'True' : 'False');
// example output: True
echo ($text->contains('foo') ? 'True' : 'False');
// example output: False
Darling\PHPTextTypes\classes\strings\classes\strings\ClassString;
$obj = (object) array('propertyName' => 'value');
$classString = new ClassString($obj);
echo $classString;
// example output: stdClass
$classString = new ClassString($classString);
echo $classString;
// example output: Darling\PHPTextTypes\classes\strings\classes\strings\ClassString
Darling\PHPTextTypes\classes\strings\classes\strings\SafeText;
use \Darling\PHPTextTypes\classes\strings\classes\strings\Text;
$safeText = new SafeText(new Text('Foo Bar Baz'));
echo $safeText;
// example output: Foo_Bar_Baz
Darling\PHPTextTypes\classes\strings\classes\strings\AlphanumericText;
use \Darling\PHPTextTypes\classes\strings\classes\strings\Text;
$alphanumericText = new AlphanumericText(
new Text('Foo_Bar baz-bazzer')
);
echo $alphanumericText;
// example output: FooBarBazBazzer
Darling\PHPTextTypes\classes\strings\classes\strings\Name;
use \Darling\PHPTextTypes\classes\strings\classes\strings\Text;
$name = new Name(new Text('Foo Bar Baz. Bin Bar-Foo Bazzer'));
echo $name;
// example output: Foo_Bar_Baz.Bin_Bar-Foo_Bazzer
Darling\PHPTextTypes\classes\strings\classes\strings\Id;
$id = new Id();
echo $id;
// example output:
// U7ok0eYte87rfdhl2nbMtLghqSQxRQH2FdOBUvjRQG5U99rEfV7m9CNiNLRMd
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.