{"id":15646804,"url":"https://github.com/voku/simple-php-code-parser","last_synced_at":"2025-04-05T15:07:23.241Z","repository":{"id":37212377,"uuid":"262177713","full_name":"voku/Simple-PHP-Code-Parser","owner":"voku","description":"❤ Simple PHP Code Parser | A simple data structure from your PHP code.","archived":false,"fork":false,"pushed_at":"2024-10-23T17:33:50.000Z","size":489,"stargazers_count":47,"open_issues_count":13,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T22:53:56.518Z","etag":null,"topics":["hacktoberfest","parse","parser","php","phpdoc","types"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voku.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["voku"],"patreon":"voku","custom":"https://www.paypal.me/moelleken"}},"created_at":"2020-05-07T23:12:37.000Z","updated_at":"2024-09-29T07:16:46.000Z","dependencies_parsed_at":"2023-02-08T09:25:14.444Z","dependency_job_id":"9d7185aa-f692-4ee9-8f55-ffdbe7e263ae","html_url":"https://github.com/voku/Simple-PHP-Code-Parser","commit_stats":{"total_commits":246,"total_committers":9,"mean_commits":"27.333333333333332","dds":0.4552845528455285,"last_synced_commit":"898f2c327749fdd46941419ad2a5a1fb0d295565"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voku%2FSimple-PHP-Code-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voku%2FSimple-PHP-Code-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voku%2FSimple-PHP-Code-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voku%2FSimple-PHP-Code-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voku","download_url":"https://codeload.github.com/voku/Simple-PHP-Code-Parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353745,"owners_count":20925329,"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":["hacktoberfest","parse","parser","php","phpdoc","types"],"created_at":"2024-10-03T12:15:01.018Z","updated_at":"2025-04-05T15:07:23.221Z","avatar_url":"https://github.com/voku.png","language":"PHP","readme":"[![Build Status](https://github.com/voku/Simple-PHP-Code-Parser/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/Simple-PHP-Code-Parser/actions)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2feaf2a179a24a5fac99cbf67e72df2f)](https://www.codacy.com/manual/voku/Simple-PHP-Code-Parser?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=voku/Simple-PHP-Code-Parser\u0026amp;utm_campaign=Badge_Grade)\n[![Latest Stable Version](https://poser.pugx.org/voku/Simple-PHP-Code-Parser/v/stable)](https://packagist.org/packages/voku/simple-php-code-parser) \n[![Total Downloads](https://poser.pugx.org/voku/simple-php-code-parser/downloads)](https://packagist.org/packages/voku/simple-php-code-parser) \n[![License](https://poser.pugx.org/voku/simple-php-code-parser/license)](https://packagist.org/packages/voku/simple-php-code-parser)\n[![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/moelleken)\n[![Donate to this project using Patreon](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://www.patreon.com/voku)\n\n# ❤ Simple PHP Code Parser\n\nYou can simply scan a string, a file or a full directory and you can see a simple data structure from your php code.\n- Classes (**PHPClass**)\n- Properties (**PHPProperties**)\n- Constants (**PHPConst**)\n- Methods (**PHPMethod**)\n- Interfaces (**PHPInterface**)\n- Traits (**PHPTrait**)\n- Functions (**PHPFunction**)\n- Parameter (**PHPParameter**)\n\nThis code is forked from [JetBrains/phpstorm-stubs](https://github.com/JetBrains/phpstorm-stubs/tree/master/tests) but you can't use the classes from \"phpstorm-stubs\" directly, \nbecause they are in a test namespace and the autoloader is \"autoload-dev\", so here is a extended version.\n\nWe will use:\n- [nikic/PHP-Parser](https://github.com/nikic/PHP-Parser)\n- [Reflection](https://www.php.net/manual/en/book.reflection.php)\n- [phpDocumentor](https://github.com/phpDocumentor/)\n- [PHPStan/phpdoc-parser](https://github.com/phpstan/phpdoc-parser)\n\n\n### Install via \"composer require\"\n\n```shell\ncomposer require voku/simple-php-code-parser\n```\n\n### Quick Start\n\nParse a string:\n```php\n$code = '\n\u003c?php\nnamespace voku\\tests;\nclass SimpleClass {}\n$obja = new class() {};\n$objb = new class {};\nclass AnotherClass {}\n';\n$phpCode = \\voku\\SimplePhpParser\\Parsers\\PhpCodeParser::getFromString($code);\n$phpClasses = $phpCode-\u003egetClasses();\n\nvar_dump($phpClasses['voku\\tests\\SimpleClass']); // \"PHPClass\"-object\n```\n\nParse one class:\n```php\n$phpCode = \\voku\\SimplePhpParser\\Parsers\\PhpCodeParser::getFromClassName(Dummy::class);\n$phpClasses = $phpCode-\u003egetClasses();\n\nvar_dump($phpClasses[Dummy::class]); // \"PHPClass\"-object\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods); // \"PHPMethod[]\"-objects\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']); // \"PHPMethod\"-object\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']-\u003eparameters); // \"PHPParameter[]\"-objects\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']-\u003eparameters['useRandInt']); // \"PHPParameter\"-object\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']-\u003eparameters['useRandInt']-\u003etype); // \"bool\"\n````\n\nParse one file:\n```php\n$phpCode = \\voku\\SimplePhpParser\\Parsers\\PhpCodeParser::getPhpFiles(__DIR__ . '/Dummy.php');\n$phpClasses = $phpCode-\u003egetClasses();\n\nvar_dump($phpClasses[Dummy::class]); // \"PHPClass\"-object\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods); // \"PHPMethod[]\"-objects\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']); // \"PHPMethod\"-object\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']-\u003eparameters); // \"PHPParameter[]\"-objects\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']-\u003eparameters['useRandInt']); // \"PHPParameter\"-object\n\nvar_dump($phpClasses[Dummy::class]-\u003emethods['withoutPhpDocParam']-\u003eparameters['useRandInt']-\u003etype); // \"bool\"\n````\n\nParse many files:\n```php\n$phpCode = \\voku\\SimplePhpParser\\Parsers\\PhpCodeParser::getPhpFiles(__DIR__ . '/src');\n$phpClasses = $phpCode-\u003egetClasses();\n\nvar_dump($phpClasses[Dummy::class]); // \"PHPClass\"-object\n````\n\n\n### Support\n\nFor support and donations please visit [Github](https://github.com/voku/simple_html_dom/) | [Issues](https://github.com/voku/simple_html_dom/issues) | [PayPal](https://paypal.me/moelleken) | [Patreon](https://www.patreon.com/voku).\n\nFor status updates and release announcements please visit [Releases](https://github.com/voku/simple_html_dom/releases) | [Twitter](https://twitter.com/suckup_de) | [Patreon](https://www.patreon.com/voku/posts).\n\nFor professional support please contact [me](https://about.me/voku).\n\n### Thanks\n\n- Thanks to [GitHub](https://github.com) (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.\n- Thanks to [IntelliJ](https://www.jetbrains.com) as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!\n- Thanks to [Travis CI](https://travis-ci.com/) for being the most awesome, easiest continous integration tool out there!\n- Thanks to [StyleCI](https://styleci.io/) for the simple but powerfull code style check.\n- Thanks to [PHPStan](https://github.com/phpstan/phpstan) \u0026\u0026 [Psalm](https://github.com/vimeo/psalm) for really great Static analysis tools and for discover bugs in the code!\n","funding_links":["https://github.com/sponsors/voku","https://patreon.com/voku","https://www.paypal.me/moelleken","https://www.patreon.com/voku","https://paypal.me/moelleken","https://www.patreon.com/voku/posts"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoku%2Fsimple-php-code-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoku%2Fsimple-php-code-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoku%2Fsimple-php-code-parser/lists"}