PHP code example of seiger / slang

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

    

seiger / slang example snippets


{{evo()->getConfig('lang')}}
or
{{evo()->getLocale()}}

{{evo()->getConfig('s_lang_default')}}

{{evo()->getConfig('s_lang_front')}}

@lang('phrase')

{!!sLang::hreflang()!!}

{{Str::upper(sLang::langSwitcher()[evo()->getConfig('lang')]['short'])}}

@foreach(sLang::langSwitcher() as $lang)
    <a href="{{$lang['link']}}">{{Str::upper($lang['ISO 639-1'])}}</a>
@endforeach

  use Seiger\sLang\Models\sLangContent;

  $items = sLangContent::active()->get(); // locale resolved via evo()->getLocale()
  

  $items = sLangContent::lang('en')->get();
  

  $items = sLangContent::withTVs(['color', 'price'])->get();
  

  $items = sLangContent::lang('uk')
      ->withTVs(['color', 'price'])
      ->whereParent($parentId)
      ->active()
      ->get();
  

  $items = sLangContent::langAndTvs('en', ['color', 'price'])->get();
  
console
php artisan package:install
console
php artisan vendor:publish --provider="Seiger\sLang\sLangServiceProvider"
console
php artisan migrate
console
php /Users/dmi3yy/PhpstormProjects/MiddleDuck/skills/dissues-demo-ops/scripts/dissues-demo.php backup
console
php tests/demo-smoke.php --url=http://127.0.0.1:8791
console
php tests/regression/slang-demo-regression.php