What's this


Read this section to know about LOGATY and its features

LOGATY is a PHP Library which can help you rapidly develop your next Multilingual Website. It can be used for CMS, Companies Site's, Personal site's, frameworks, etc. It's based on PHP Language and contains a lot of Functions to easily make your interactive Website. .


Check out some of features that we have in this Library. To know more about features of LOGATY, continue reading our documentation and check our available components .

  • JSON Format

    Using Json Format For Static Content.

  • Database Content

    Save and Retrieve Dynamic Content From Database.

  • Language Switcher

    Allow to users and visitor Choice his Language.

  • Detect Language

    Easy Way to Detect User Browser or Country Language .

  • Links

    Generate links with Selected language.

  • Support All Languages

    You Can add, remove, change languages from Config file or Admin Panel and you can allow admin to edit translation from Admin Panel .

  • Free Download

    you can download and use library without any cost.

  • And More

What's included

Checkout the files that you'll see upon downloading

Once you download the Library, you can see a folder with several files and sub folders. You can read description of some important files in continue.

  • inc
    • classes
      • Translator.php class responsible for retrieving translation from json files .
      • Detect.phpclass Contain 2 Methods to Detect User Language .
      • DBTranslator.php class responsible for retrieving translation from Database .
      • Link.phpto create correct links with selected language .
      • Config.phpGet Option or Config Value (OLD WAY)
      • Libs Contain 'phptricks-PDO-class' external class
    • functions
      • functions.phpsome functions (API) to use library components in easy .
  • languagesHere is a place to put your JSON files for translations .
  • flagsContain flags icons, you can change icons or keep it.
  • core
    • init.phpinitialize library (main file) autoload classes , include all files and define variables and constants .
    • detect_visitor_language.phpits file to describe how to detect visitor language, best way to do that -- you can delete it or change it .
  • config.phpwe use this file in older version for set init values of configuration, in this version we use it to parse ini config file .
  • vendor composer components for classes auto-loader.
  • composer.json using composer for psr-4 auto-loader only.
  • README.md about me ,library and licence.
Get help hands

Quick start

Now it's time to start editing some lines of code and config library as your project need

Start Using LOGATY. It won't take more than 5 minutes to start. Read the step-by-step guide .

  • Config Library

    Start Config LOGATY Library as your project need.
    Go to config.php file and set default configuration.
    See this Page

  • Include Library

    include autoload.php file from your-project/libs/logaty/vendor/autoload.php and start using the library .

Basic Usage

Very Fast Usage

Here Simple example to using LOGATY

include library:


go to (logaty/config.php) and configure library how you want

  • choice default language.
  • enable/disable detected browser language.
  • enable/disable detected country language.
  • enable/disable hide untranslated contents.
  • ... etc.

translate sentences :

in path (logaty/languages). create ( json ) file called by ISO CODE language. (en-US, fr-FR) ... etc.

write in json file :

    "FILE-NAME": {
        "Original sentence ":"translated ..."

Example :

    "de_DE": {
        "Hi there I'm a Multilingual Library :)":"Hallo zusammen, ich bin ein Mehrsprachige Bibliothek :)",
        "Detected Your Brouser Language is :" : "Erkannte Ihre Brouser Sprache ist:"



to echo directly.

__("This is Original sentence");


echo _x("This is Original sentence");

and you can get sentence in any language you need

echo _x("This is Original sentence ", 'de');
// output the sentence in German even if other language is selected

__("This is Original sentence ", 'sp');
// output the sentence in Spain even if other language is selected

Create Link's with selected Language

to create link to same page in other language:

logatyLink('', 'lang-code');
logatyLink('', 'en');
logatyLink('', 'ar');


<a href="<?php echo logatyLink('', 'en');?>"> ENGLISH</a>
<a href="<?php echo logatyLink('', 'ar');?>"> ARABIC</a>

to create link to other page in same language:

logatyLink('THE URL');

to create link to other page in other language


logatyLink('THE URL', 'lang-code');

Detected browser or country language :

$detect = new Detect();
$detect->browser(); // to detect browser language

$detect->country(); // to detect country language
return language ISO code 2-digit

Do you think that's it? Of course not, if you want more features and adequate explanations for everything in LOGATY you can follow Read documentation. I have allocated documented for each feature with detailed explanations for those who want.