{"id":17216857,"url":"https://github.com/xethron/to-string","last_synced_at":"2025-04-13T23:22:47.354Z","repository":{"id":13747556,"uuid":"16441988","full_name":"Xethron/to-string","owner":"Xethron","description":"Converts Variables to strings (like print_r) with limiting functions, and Exceptions to strings without cutting off important information.","archived":false,"fork":false,"pushed_at":"2014-02-23T22:13:02.000Z","size":152,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T00:52:55.030Z","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:29:51.000Z","updated_at":"2018-01-23T08:03:29.000Z","dependencies_parsed_at":"2022-09-22T14:41:03.130Z","dependency_job_id":null,"html_url":"https://github.com/Xethron/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%2Fto-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fto-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fto-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xethron%2Fto-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xethron","download_url":"https://codeload.github.com/Xethron/to-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795176,"owners_count":21162725,"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:31.308Z","updated_at":"2025-04-13T23:22:47.318Z","avatar_url":"https://github.com/Xethron.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"ToString\n========\n\n[![Latest Stable Version](https://poser.pugx.org/xethron/to-string/v/stable.png)](https://packagist.org/packages/xethron/to-string) [![Total Downloads](https://poser.pugx.org/xethron/to-string/downloads.png)](https://packagist.org/packages/xethron/to-string) [![Latest Unstable Version](https://poser.pugx.org/xethron/to-string/v/unstable.png)](https://packagist.org/packages/xethron/to-string) [![License](https://poser.pugx.org/xethron/to-string/license.png)](https://packagist.org/packages/xethron/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\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\\ToString::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\\ToString::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\\ToString::exception( $e ); // This will print out the entire Exception`\n\n`Xethron\\ToString::trace( $e-\u003egetTrace() ); // This will only print out the stack trace`\n\nLicense\n=======\n\nToString 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%2Fto-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxethron%2Fto-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxethron%2Fto-string/lists"}