1. Go to this page and download the library: Download eru/avro-phonetic 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/ */
eru / avro-phonetic example snippets
Avro::to('rri'); // ঋ (at word start)
Avro::to('krri'); // কৃ (after consonant)
Avro::to('OI'); // ঐ (standalone)
Avro::to('kOI'); // কৈ (after consonant)
use Eru\AvroPhonetic\Avro;
// Static method
echo Avro::to('ami banglay gan gai');
// Output: আমি বাংলায় গান গাই
// Instance method
$avro = new Avro();
echo $avro->parse('amar sonar bangla');
// Output: আমার সনার বাংলা
// Quick conversion
echo avro('bangladesh'); // বাংলাদেশ
echo bangla('dhaka'); // ঢাকা
// Get instance for chaining
$result = avro()->parse('tumi kemon acho');
use Eru\AvroPhonetic\Facades\Avro;
// In your controller
public function store(Request $request)
{
$bengaliText = Avro::to($request->input('text'));
// ...
}
use Eru\AvroPhonetic\Avro;
// Static conversion
Avro::to(string $text): string
// Instance methods
$avro = new Avro();
$avro->parse(string $text): string
$avro->convert(string $text): string // Alias for parse()
// Factory methods
Avro::getInstance(): Avro // Singleton
Avro::withGrammar(array $grammar): Avro // Custom grammar
Avro::fromGrammarFile(string $path): Avro // Load from file
// Access parser
$avro->getParser(): PhoneticParser
// Convert text or get instance
avro(?string $text = null): Avro|string
// Always converts text
bangla(string $text): string