PHP code example of roelofjan-elsinga / url-language-extractor
1. Go to this page and download the library: Download roelofjan-elsinga/url-language-extractor 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/ */
roelofjan-elsinga / url-language-extractor example snippets
$short_code = LanguageExtractor::forUrl('/page/en/content-page')
->setAcceptedShortCodes(['en', 'nl', 'es', 'fr'])
->extract();
print $short_code; // 'en'