{"id":25257523,"url":"https://github.com/czproject/phpdepend","last_synced_at":"2025-10-27T02:31:53.116Z","repository":{"id":6669899,"uuid":"7914686","full_name":"czproject/phpdepend","owner":"czproject","description":"Extracts list of dependencies (classes, interfaces \u0026 traits) from PHP file or code snippet.","archived":false,"fork":false,"pushed_at":"2023-03-31T09:02:56.000Z","size":78,"stargazers_count":9,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T08:23:26.420Z","etag":null,"topics":["code-analysis","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/czproject.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-30T13:02:31.000Z","updated_at":"2024-09-04T03:50:27.000Z","dependencies_parsed_at":"2022-08-21T09:20:55.318Z","dependency_job_id":null,"html_url":"https://github.com/czproject/phpdepend","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fphpdepend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fphpdepend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fphpdepend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fphpdepend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/czproject","download_url":"https://codeload.github.com/czproject/phpdepend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238424927,"owners_count":19470211,"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":["code-analysis","php"],"created_at":"2025-02-12T06:40:25.174Z","updated_at":"2025-10-27T02:31:53.110Z","avatar_url":"https://github.com/czproject.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PhpDepend\n=========\n\n[![Build Status](https://github.com/czproject/phpdepend/workflows/Build/badge.svg)](https://github.com/czproject/phpdepend/actions)\n[![Downloads this Month](https://img.shields.io/packagist/dm/czproject/phpdepend.svg)](https://packagist.org/packages/czproject/phpdepend)\n[![Latest Stable Version](https://poser.pugx.org/czproject/phpdepend/v/stable)](https://github.com/czproject/phpdepend/releases)\n[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/czproject/phpdepend/blob/master/license.md)\n\nExtracts list of dependencies (classes, interfaces \u0026 traits) from PHP file or code snippet.\n\n\u003ca href=\"https://www.janpecha.cz/donate/\"\u003e\u003cimg src=\"https://buymecoffee.intm.org/img/donate-banner.v1.svg\" alt=\"Donate\" height=\"100\"\u003e\u003c/a\u003e\n\n\nInstallation\n------------\n\n[Download a latest package](https://github.com/czproject/phpdepend/releases) or use [Composer](http://getcomposer.org/):\n\n```\ncomposer require czproject/phpdepend\n```\n\nPhpDepend requires PHP 8.0 or later and enabled [Tokenizer extension](http://www.php.net/manual/en/book.tokenizer.php) (enabled by default from PHP 4.3.0).\n\n\nUsage\n-----\n\n``` php\n$phpdepend = new CzProject\\PhpDepend\\PhpDepend;\n\n// file parsing\n$phpdepend-\u003eparseFile('MyClass.php');\n\n// code snippet parsing\n$source = file_get_contents('MyClass.php');\n$phpdepend-\u003eparse($source);\n\n// getting result\n$phpdepend-\u003egetClasses(); // returns list of defined classes, interfaces \u0026 traits\n$phpdepend-\u003egetDependencies(); // returns list of required classes, interfaces \u0026 traits\n```\n\nRecognized dependencies in PHP code:\n* inherited classes (`extends ParentClass`)\n* implemented interfaces (`implements InterfaceA, InterfaceB`)\n* used traits (`class MyClass { use Trait; }`)\n* classes of created instances (`new Object()`)\n* static classes (`StaticClass::staticMethod()`, `StaticClass::$staticProperty`)\n\nIgnored dependencies:\n* `self::` - `self` means \"this class\" → useless (no dependency, class is defined in same file)\n* `parent::` - parent class is specified in `extends`\n* `static::` - `static` is dynamic-`self` → means \"this class\", parent or descendant (if exists)\n\nRecognized defined classes (output of `$phpdepend-\u003egetClasses()`):\n* defined classes (`class MyClass`)\n* defined interfaces (`interface MyInterface`)\n* defined traits (`trait MyTrait`)\n\n\nExample\n-------\n\n``` php\n\u003c?php\n$phpdepend = new CzProject\\PhpDepend\\PhpDepend;\n$phpdepend-\u003eparse('\n\u003c?php\n\tclass Greeting implements IGreeting\n\t{\n\t\tpublic function say($name)\n\t\t{\n\t\t\tif (!$name) {\n\t\t\t\tthrow new InvalidArgumentException(\"Invalid name\");\n\t\t\t}\n\t\t\treturn \"Hello $name\";\n\t\t}\n\t}\n\n\t$greeting = new Greeting;\n\t$greeting-\u003esay(\"John\");\n');\n\nvar_dump($phpdepend-\u003egetClasses());\n/* Output:\narray (1) {\n\t'Greeting'\n}\n*/\n\nvar_dump($phpdepend-\u003egetDependencies());\n/* Output:\narray (3) {\n\t'IGreeting',\n\t'InvalidArgumentException',\n\t'Greeting',\n}\n*/\n```\n\n\n------------------------------\n\nLicense: [New BSD License](license.md)\n\u003cbr\u003eAuthor: Jan Pecha, https://www.janpecha.cz/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczproject%2Fphpdepend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fczproject%2Fphpdepend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczproject%2Fphpdepend/lists"}