{"id":14966349,"url":"https://github.com/yiisoft/var-dumper","last_synced_at":"2025-10-19T09:31:12.299Z","repository":{"uuid":"184578203","full_name":"yiisoft/var-dumper","owner":"yiisoft","description":"Helper for dumping variable for debug purposes","archived":false,"fork":false,"pushed_at":"2024-04-04T12:22:27.000Z","size":287,"stargazers_count":20,"open_issues_count":4,"forks_count":13,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-04-15T03:04:18.765Z","etag":null,"topics":["debug","debugging","dump","hacktoberfest","vardump","vardumper","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"]}},"created_at":"2019-05-02T12:37:09.000Z","updated_at":"2024-04-13T16:32:10.000Z","dependencies_parsed_at":"2023-02-10T06:35:17.110Z","dependency_job_id":"efda9132-9018-4352-9d01-801994e14355","html_url":"https://github.com/yiisoft/var-dumper","commit_stats":{"total_commits":219,"total_committers":17,"mean_commits":"12.882352941176471","dds":0.634703196347032,"last_synced_commit":"c3a532e3ef5f2bd551c6e6683ecaa389d47c40f9"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fvar-dumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fvar-dumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fvar-dumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fvar-dumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/var-dumper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":196771524,"owners_count":13262047,"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":["debug","debugging","dump","hacktoberfest","vardump","vardumper","yii3"],"created_at":"2024-09-24T13:36:15.397Z","updated_at":"2025-10-19T09:31:11.947Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii VarDumper\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/var-dumper/v)](https://packagist.org/packages/yiisoft/var-dumper)\n[![Total Downloads](https://poser.pugx.org/yiisoft/var-dumper/downloads)](https://packagist.org/packages/yiisoft/var-dumper)\n[![Build status](https://github.com/yiisoft/var-dumper/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/var-dumper/actions/workflows/build.yml)\n[![Code Coverage](https://codecov.io/gh/yiisoft/var-dumper/branch/master/graph/badge.svg)](https://codecov.io/gh/yiisoft/var-dumper)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fvar-dumper%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/var-dumper/master)\n[![static analysis](https://github.com/yiisoft/var-dumper/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/var-dumper/actions?query=workflow%3A%22static+analysis%22)\n[![type-coverage](https://shepherd.dev/github/yiisoft/var-dumper/coverage.svg)](https://shepherd.dev/github/yiisoft/var-dumper)\n\n`VarDumper` enhances functionality of `var_dump()` and `var_export()`. It is dealing with recursive references,\nmay highlight syntax and export closures.\n\n## Requirements\n\n- PHP 8.0 or higher.\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/var-dumper\n```\n\n## General usage\n\n### Quick debugging\n\nIn case you want to echo a string representing variable contents use the following code:\n\n```php\n\\Yiisoft\\VarDumper\\VarDumper::dump($variable);\n```\n\nThat is useful for quick debugging. By default, it goes deep `10` levels into variable and highlights syntax. You may\nadjust these settings via second and third argument of the method respectively.\n\nFor convenience, you can use the functions:\n\n```php\n// Prints variables:\nd($variable, /* Further variables to dump. */);\n// The same as above\ndump($variable, /* Further variables to dump. */);\n\n// Prints variables and terminate the current script:\ndd($variable, /* Further variables to dump. */);\n```\n\n### Formatting debug string\n\nTo get a string representing variable contents, same as above but without `echo`:\n\n```php\n$string = \\Yiisoft\\VarDumper\\VarDumper::create($variable)-\u003easString(10, true);\n```\n\n`10` is maximum recursion depth and `true` is telling dumper to\nhighlight syntax.\n\n### Exporting as PHP code\n\nIn order to get a valid PHP expression string that can be evaluated by PHP parser,\nand the evaluation result will give back the variable value, use the following code:\n\n```php\n$string = \\Yiisoft\\VarDumper\\VarDumper::create($variable)-\u003eexport();\n```\n\nIt is similar to `var_export()` but uses short array syntax, handles closures, and serializes objects.\n\nIn the above `export()` will give you nicely formatted code. You can remove formatting by passing `false` as the first\n`$format` argument.\n\n`$useVariables` argument allows specifying array of variables that will be in `use` statement for closures.\nThat is especially useful if an object contains callbacks that should get info from upper scope.\n\n`$serializeObjects` argument when given `false` allows to force turn off using of serialization for objects so instead\nclosures and reflection API are used the same was as for exporting closures. De-serialization performance is better.\nClosures are way more readable.\n\n### Exporting as JSON string\n\n```php\n$string = \\Yiisoft\\VarDumper\\VarDumper::create($variable)-\u003easJson();\n```\n\nIt is similar to `json_encode()` but uses short array syntax, handles closures, and serializes objects.\n\nIn the above `asJson()` will give you nicely formatted code. You can remove formatting by passing `false` as the first\n`$format` argument.\n\n`$depth` argument allows you to set maximum recursion depth.\n\n## Output destination\n\nChoose one of existing classes or create a new one to control the destination where \"dumps\" will be sent to:\n\n- [EchoHandler](./src/Handler/EchoHandler.php)\n  - Uses `echo` to write to stdout stream.\n  - Used by default.\n- [StreamHandler](./src/Handler/StreamHandler.php)\n  - Uses `ext-sockets` to sent dumps encoded with `json_encode` to a UDP socket.\n- [CompositeHandler](./src/Handler/CompositeHandler.php)\n  - Helpful class to sent dumps to multiple handlers in a row, for example `EchoHandler` and `StreamHandler`.\n\nOutput handlers are set via `VarDumper::setDefaultHandler()` method.\n\n## Limitations\n\nCurrent limitations are:\n\n- Variables or properties that are anonymous classes or contain anonymous classes are not supported.\n\n## Documentation\n\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.\nYou may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii VarDumper is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n### Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n### Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3ru)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fvar-dumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Fvar-dumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fvar-dumper/lists"}