PHP code example of techecosystem / parsify-php

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

    

techecosystem / parsify-php example snippets

bash
composer 
 php
    $builder = PersianConverterBuilder::create();
    
 php
    $builder->withNumberConversion(true);
    
 php
    $builder->withTextNormalization(false);
    
 php
    $converter = $builder->build();
    
 php
    $converter = PersianConverter::createDefault();
    
 php
    $convertedText = $converter->convert("متن فارسی 123");
    
 php
    $normalizedText = PersianTextService::normalize("متن فارسی 123");
    
 php
    $normalizedText = PersianTextService::normalizeTextWithEnglishNumbers("متن فارسی 123");
    
 php
    $normalizedText = PersianTextService::normalizeTextWithoutNumbers("متن فارسی 123");
    
 php
   echo PersianTextService::normalize("𞸮ﻼم 123 يوﺱ𞺰");
   // Outputs: "سلام ۱۲۳ یوسف"
   
 php
   echo PersianTextService::normalizeTextWithEnglishNumbers("𞸮ﻼم 123 يوﺱ𞺰");
   // Outputs: "سلام 123 یوسف"
   
 php
   echo PersianTextService::normalizeTextWithoutNumbers("𞸮ﻼم 123 يوﺱ𞺰");
   // Outputs: "سلام 123 یوسف"
   
 php
   $converter = PersianConverterBuilder::create()
       ->withTextNormalization(false)
       ->withNumberConversion()
       ->build();
   echo $converter->convert("𞸮ﻼم 123 يوﺱ𞺰");
   // Outputs: "سلام ۱۲۳ یوسف"
   
 php
   $converter = PersianConverterBuilder::create()
       ->withTextNormalization(keepPersianDiacritic: false)
       ->build();
   
   $input = "حَتماً";
   echo $converter->convert($input);
   // Outputs: حتما