{"id":17216862,"url":"https://github.com/xethron/l4-to-string","last_synced_at":"2026-06-29T05:31:34.053Z","repository":{"id":13747670,"uuid":"16442102","full_name":"Xethron/l4-to-string","owner":"Xethron","description":"Laravel 4 version of xethron/to-string, which adds query and queryLog to string functions.","archived":false,"fork":false,"pushed_at":"2014-02-05T12:28:35.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T02:11:23.608Z","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/Xethron.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-02-01T20:36:24.000Z","updated_at":"2014-02-05T12:28:35.000Z","dependencies_parsed_at":"2022-08-24T14:07:13.546Z","dependency_job_id":null,"html_url":"https://github.com/Xethron/l4-to-string","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fl4-to-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fl4-to-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fl4-to-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fl4-to-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xethron","download_url":"https://codeload.github.com/Xethron/l4-to-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245474780,"owners_count":20621468,"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-15T03:42:32.033Z","updated_at":"2026-06-29T05:31:34.045Z","avatar_url":"https://github.com/Xethron.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"L4ToString\n========\n\n[![Latest Stable Version](https://poser.pugx.org/xethron/l4-to-string/v/stable.png)](https://packagist.org/packages/xethron/l4-to-string) [![Total Downloads](https://poser.pugx.org/xethron/l4-to-string/downloads.png)](https://packagist.org/packages/xethron/l4-to-string) [![Latest Unstable Version](https://poser.pugx.org/xethron/l4-to-string/v/unstable.png)](https://packagist.org/packages/xethron/l4-to-string) [![License](https://poser.pugx.org/xethron/l4-to-string/license.png)](https://packagist.org/packages/xethron/l4-to-string)\n\nLogging variables can sometimes cause huge logs, especially if you want to email those logs to yourself.\n\nOn the other hand, logging exceptions with the default __toString can will most likely give you just enough information to confuse the hell out of you!\n\nThis class extends Xethron\\ToString, and in addition, adds a few Laravel 4 specific functions for converting Query Logs to Strings.\n\nVariable to String\n==================\n\nThis is a function that will display a variable similar to print_r, with the ability to specify the max_lines, max_depth (for arrays) and min_depth (for arrays).\n\nThis means that you will never get an email with an array 3000 lines long as you would with print_r.\n\n`Xethron\\L4ToString::variable( $var, $max_lines, $max_depth, $min_depth )`\n\nI recommend adding a global function to one of your startup files for easier access:\n\n```php\nfunction varToStr( $var, $max_lines = 10, $max_depth = 4, $min_depth = 2 )\n{\n    return Xethron\\L4ToString::variable( $var, $max_lines, $max_depth, $min_depth );\n}\n```\nException to String\n===================\n\nThis converts an Exception to string, much like PHP's __toString, however, it won't cut off those important pieces of information you require while debugging.\n\nOn top of that, it also uses the Variable to String to to include all the variables passed in the Stack Trace.\n\nTwo functions are available:\n---------------------------\n\n`Xethron\\L4ToString::exception( $e ); // This will print out the entire Exception`\n\n`Xethron\\L4ToString::trace( $e-\u003egetTrace() ); // This will only print out the stack trace`\n\nQuery Log to String\n===================\n\nThis will convert the Laravel 4 Query Log to a neat Query String like:\n```txt\n#0 select * from `table` where `table`.`id` = 113 and `deleted` = 0 limit 1;\n    {\"bindings\":[113,0],\"time\":1.08}\n#1 select * from `another_table` where `another_table`.`deleted_at` is null and `id` = '66' limit 1;\n\t{\"bindings\":[\"66\"],\"time\":0.49}\n#2 select * from `country` where `country`.`deleted` = 0 and `country`.`name` in ('South Africa');\n\t{\"bindings\":[0,\"South Africa\"],\"time\":0.51}\n```\n\nTwo Functions are available:\n----------------------------\n\n`Xethron\\L4ToString::queryLog(); // gets the latest query log and prints it`\n`Xethron\\L4ToString::queryLog( \\DB::getQueryLog() ); // Specify your own query log`\n`Xethron\\L4ToString::query( $qyery ); // Pass a single query from the query log to be converted to string`\n\nLicense\n=======\n\nL4ToString is distributed under the terms of the GNU General Public License, version 3 or later.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxethron%2Fl4-to-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxethron%2Fl4-to-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxethron%2Fl4-to-string/lists"}