{"id":15563786,"url":"https://github.com/glutexo/jsvar","last_synced_at":"2025-03-12T12:17:33.346Z","repository":{"id":19911743,"uuid":"23177376","full_name":"Glutexo/jsvar","owner":"Glutexo","description":"JavaScript object composer for PHP that allows raw JS expressions.","archived":false,"fork":false,"pushed_at":"2014-08-23T11:47:59.000Z","size":136,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T05:49:59.071Z","etag":null,"topics":[],"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/Glutexo.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":"2014-08-21T06:57:08.000Z","updated_at":"2014-08-21T06:57:15.000Z","dependencies_parsed_at":"2022-08-24T17:51:03.332Z","dependency_job_id":null,"html_url":"https://github.com/Glutexo/jsvar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glutexo%2Fjsvar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glutexo%2Fjsvar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glutexo%2Fjsvar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glutexo%2Fjsvar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Glutexo","download_url":"https://codeload.github.com/Glutexo/jsvar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243213984,"owners_count":20254902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-02T16:26:47.633Z","updated_at":"2025-03-12T12:17:33.322Z","avatar_url":"https://github.com/Glutexo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json_encode replacement that allows raw JS values #\n\nEver wanted to compose a JavaScript object using PHP, but _json_encode_ wasn’t enough because it support only scalar values? This class allows you to put any arbitraty code in the object, e.g. function calls, expressions, variables etc.\n\nThe value of JsVar and JsRawVar object can be accessed and modified by its _value_ attribute.\n\nJsVar and JsRawVar objects can be used as strings.\n\n## Usage ##\n\nHere is an example of a jQuery AJAX call options object composed in PHP. The\nsuccess callback is put there as raw JavaScript. Because the $prefix is not a\nsimple string, but a JsVar instance, it can be used directly in the string\nwithout calling _json_encode_ and it still gets encoded.\n\n```php\n$prefix = new JsVar(\"Response is: \");\n\n$obj = new JsVar(array(\n\t'url' =\u003e 'my_awesome_script.php',\n\t'method' =\u003e 'POST',\n\t'success' =\u003e new JsRawVar(\"function(data) { alert($prefix + data); }\")\n));\n\nprint $obj;\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglutexo%2Fjsvar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglutexo%2Fjsvar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglutexo%2Fjsvar/lists"}