1. Go to this page and download the library: Download wikimedia/ipa-validator 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/ */
wikimedia / ipa-validator example snippets
// Load composer's autoloader
kimedia\IPAValidator\Validator;
/*
* Create a new validator with the options:
* - Remove delimiters (defaults to true)
* - Normalize IPA (defaults to false)
* - Normalize to Google TTS standard (defaults to false)
*/
$validator = new Validator( '/pʰə̥ˈkj̊uːliɚ/', true, true, true );
// Check if the IPA is valid
echo $validator->valid; # true
// Get the normalized IPA
echo $validator->normalizedIPA; # phəˈkjuːliɚ
// Get the original IPA
echo $validator->originalIPA; # /pʰə̥ˈkj̊uːliɚ/
/**
* Constructor
*
* @param string $ipa IPA to validate
* @param bool $strip Remove delimiters
* @param bool $normalize Normalize IPA
* @param bool $google Normalize IPA for Google TTS
*/
public function __construct( $ipa, $strip = true, $normalize = false, $google = false )