{"id":18407523,"url":"https://github.com/simplecomplex/inspect","last_synced_at":"2026-02-09T17:03:21.938Z","repository":{"id":27235452,"uuid":"30707030","full_name":"simplecomplex/inspect","owner":"simplecomplex","description":"PHP+JS variable inspection and error/back tracing","archived":false,"fork":false,"pushed_at":"2023-11-04T10:22:54.000Z","size":307,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T07:06:22.051Z","etag":null,"topics":["inspection","php","php7","psr","trace"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplecomplex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-12T14:51:18.000Z","updated_at":"2023-11-04T10:21:44.000Z","dependencies_parsed_at":"2022-08-24T03:40:50.225Z","dependency_job_id":"2f5b5edf-a91f-49c4-9ac1-a407cfcbdfd9","html_url":"https://github.com/simplecomplex/inspect","commit_stats":{"total_commits":160,"total_committers":2,"mean_commits":80.0,"dds":0.006249999999999978,"last_synced_commit":"c88790c74d16876c804f5b7eab069ddfc5d14bd3"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/simplecomplex/inspect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplecomplex%2Finspect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplecomplex%2Finspect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplecomplex%2Finspect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplecomplex%2Finspect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplecomplex","download_url":"https://codeload.github.com/simplecomplex/inspect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplecomplex%2Finspect/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267135837,"owners_count":24041115,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["inspection","php","php7","psr","trace"],"created_at":"2024-11-06T03:14:21.734Z","updated_at":"2026-02-09T17:03:16.482Z","avatar_url":"https://github.com/simplecomplex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## (PHP+JS) Inspect: variable dumps and stack traces ##\n\n- [Description](#Description)\n- [License](#MIT-licensed)\n- [Requirements](#Requirements)\n\n### Get Inspect ###\n```PHP\n// If dependency injection container exists.\n$inspect = $container-\u003eget('inspect');\n// Otherwise use maker.\n$inspect = \\SimpleComplex\\Inspect\\Inspect::getInstance();\n```\n\n### Principal methods and options ###\n\n#### (int) $options ####\n\n`depth`: max object/array recursion; DEPTH_DEFAULT/TRACE_DEPTH_DEFAULT\n\n#### (array) $options ####\n\n- (int) `depth`: max object/array recursion; DEPTH_DEFAULT/TRACE_DEPTH_DEFAULT\n- (int) `limit`: max trace frame; TRACE_LIMIT_DEFAULT\n- (int) `code`: error code, overrides exception code; none\n- (int) `truncate`: string truncation; TRUNCATE_DEFAULT\n- (arr) `skip_keys`: skip those object/array keys; none\n- (arr) `needles`: replace in strings; NEEDLES/NEEDLES_ESCAPE_HTML\n- (arr) `replacers`: replace in strings; REPLACERS/REPLACERS_ESCAPE_HTML\n- (bool) `escape_html`: replace in strings; ESCAPE_HTML\n- (int) `output_max`: replace in strings; OUTPUT_DEFAULT\n- (int) `exectime_percent`: replace in strings; EXEC_TIMEOUT_DEFAULT\n- (bool) `rootdir_replace`: replace root dir in strings; ROOT_DIR_REPLACE\n- (int) `wrappers`: number of wrapping functions/methods, to be hidden; zero\n\n#### inspect($subject, $options = []): Inspector ####\n\nDo variable inspection, unless arg $subject is a throwable; then trace.\n```PHP\n$var = 'what is this?'; $xcptn = new \\Exception('Doh');\n\n// Inspect:\n$inspect-\u003einspect($var);\n// Trace:\n$inspect-\u003einspect($xcptn);\n```\n\n#### variable($subject, $options = []): Inspector ####\n\nForce variable inspection, even if subject is a throwable.\n```PHP\n$inspect-\u003evariable($var);\n```\n\n#### trace($throwableOrNull, $options = []): Inspector ####\n\nTrace exception or do back-trace.\n```PHP\n// Trace exception:\n$inspect-\u003etrace($xcptn);\n// Do back-trace:\n$inspect-\u003etrace(null);\n```\n\n#### Logging ####\n\nThe Inspector returned by inspect|variable|trace() is stringable. Pass it directly to a PSR logger:\n```PHP\n$logger-\u003edebug('Darned ding' . \"\\n\" . $inspect-\u003evariable($var));\n```\n\nOr use the Inspector's own chainable PSR logger-like method:\n\n**log($level = 'debug', $message = '', array $context = []): void**\n\n```PHP\n$inspect-\u003evariable($var)-\u003elog('debug', 'darned ding');\n```\n\n### Javascript ###\n\n(object) options\n\n- (string) `message`: content headline and options as string also interprets to message (except when 'protos'/'func_body')\n- (integer) `depth`: array|object recursion max (default 10, max 10)\n- (boolean) `protos`: analyze prototypal properties too\n- (boolean) `func_body`: print bodies of functions\n- (string) `type`: default 'inspect'/'inspect trace'\n- (string) `severity`: default 'debug'/'error'\n\nTo console:  \n```javascript\nwindow.inspect(u, options);\nwindow.inspect.trace(er, options);\n```\n\n\u003c!--\nTo server log:  \n`inspect.log(u, options);`  \n`inspect.traceLog(er, options);`\n--\u003e\n\n### Description ###\n\nProduces tidy and informative variable dumps and exception/back traces.  \nTailormade and ready for logging - the inspect/variable/trace() methods return a stringable object.\n\n#### Safe ####\n\nThe inspector and tracer guarantee not to fail.\nA simple PHP:var_dump() is prone to raise a PHP error if you dump a large or complex array like $GLOBALS, due to references (recursion).  \nInspect limits it's recursion into sub arrays/objects. It also keeps track of how large an output it produces. And it finally makes sure that max execution time doesn't get exceeded.\n\n#### Secure ####\n\nInspect hides the values of array/object buckets named 'pw', 'pass' and 'password'.  \nAnd values of other sensitives can be hidden using 'skip_keys' option.\n\n#### PHP and Javascript ####\n\nInspect consists of a PHP library for serverside inspection and tracing, and a Javascript library for clientside ditto.  \nNB: The Javascript library has not been maintained since 2015.\n\n#### Maturity ####\n\nThe library has existed in various forms since 2010.\nThe core has been refined continuously whereas the wrapping has evolved from a rather oldschool OOP pattern over a solid but non-orthodox Drupal style, to well-behaved PSR/Composer patterns. \n\n#### Used in - *extended by* - Drupal ####\n\nThe backbone of the [Drupal Inspect module](https://drupal.org/project/inspect) is SimpleComplex Inspect.\nThe Drupal module (D7 as well as D8) extends Inspect to accomodate to the context - that is: uses Drupal's APIs and features when it makes sense.\n\n### MIT licensed ###\n\n[License and copyright](https://github.com/simplecomplex/inspect/blob/master/LICENSE).\n[Explained](https://tldrlegal.com/license/mit-license).\n\n### Requirements ###\n\n- PHP \u003e=8.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplecomplex%2Finspect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplecomplex%2Finspect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplecomplex%2Finspect/lists"}