{"id":36397460,"url":"https://github.com/themahabbat/lang-php","last_synced_at":"2026-01-11T16:00:37.165Z","repository":{"id":48327555,"uuid":"130557745","full_name":"themahabbat/Lang-PHP","owner":"themahabbat","description":"Language changer for PHP","archived":false,"fork":false,"pushed_at":"2018-04-22T18:32:01.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-23T20:43:59.317Z","etag":null,"topics":["change","changer","global","lang","language","php","variables"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/themahabbat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-22T10:36:47.000Z","updated_at":"2022-06-17T20:35:44.000Z","dependencies_parsed_at":"2022-09-18T22:23:57.096Z","dependency_job_id":null,"html_url":"https://github.com/themahabbat/Lang-PHP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/themahabbat/Lang-PHP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themahabbat%2FLang-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themahabbat%2FLang-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themahabbat%2FLang-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themahabbat%2FLang-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themahabbat","download_url":"https://codeload.github.com/themahabbat/Lang-PHP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themahabbat%2FLang-PHP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28312078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["change","changer","global","lang","language","php","variables"],"created_at":"2026-01-11T16:00:19.684Z","updated_at":"2026-01-11T16:00:37.081Z","avatar_url":"https://github.com/themahabbat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lang-PHP\nLanguage changer for PHP\n\n## Initialization\nAdd `\"minimum-stability\": \"dev\"` to `composer.json`\n\nRun `composer require themahabbat/lang`\n\n### Parameters\n`current`: Current language\n\n`available`: Array of available languages\n\n`dir` (optional): Directory of language files exists (default: lang)\n\n`default`: Default language if current language doesn't match available languages\n\n`cookie` (optional): Cookie name (default: LANG)\n\n`cookieExpire` (optional): Expire time for cookies in Unix timestamp (default: 168 days)\n\n### How it works\nScript finds `.json` files in given language directory then initializes it\n\n### Code\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse Mahabbat\\Lang;\n\n$L = Lang::init([\n\n  'current' =\u003e      $_GET['lang'],\n  'available' =\u003e    ['az', 'en'],\n  'default' =\u003e      'az',\n  'cookie' =\u003e       'LANG',\n  'cookieExpire' =\u003e time()+86400*24*7\n\n]);\n```\n\n## Usage\n### Single Key\nGets keyName from current language's json file\n\nExample JSON: `{ \"keyName\": \"Hi there!\" }`\n```php\n\u003c?php\necho $L-\u003ekey('keyName');  // Hi there!\n```\n\n### Nested keys\n\nExample JSON: `{ \"keyName\": [ {\"inside\": \"This is the value inside keyName\" } ] }`\n```php\n\u003c?php\necho $L-\u003ekey('keyName@inside');   // This is the value inside keyName\n```\n\n### Variables\n\nExample JSON: `{ \"keyName\": \"Hello :name !\" }`\n\n```php\n$values = [ 'name' =\u003e 'Mahabbat!' ];\necho $L-\u003ekey('keyName', $values);   // Hello Mahabbat !\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemahabbat%2Flang-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemahabbat%2Flang-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemahabbat%2Flang-php/lists"}