PackageTrack
Sign in Get early access

voku/simple-php-code-parser

Get a simple data structure from your php code.

0.22.3 42K downloads/mo #3485 most downloaded on Packagist voku/Simple-PHP-Code-Parser

What this package is like to depend on

Last release 7 days ago

16 Aug 2026

Ships unpredictably

gaps range from 1 weeks to 2.7 years

Nearly every release is documented

notes for 46 of 46 stable releases

Nothing withdrawn

no release was ever pulled

6 years old

46 releases · first in 2020

5 releases in the last 12 months

see the full history below

Release timeline

46 releases · May 2020 to Aug 2026
2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 46
  1. 0.22.3 16 Aug 2026
    Release notes
    • add AstNodeInspector helpers for exact node source slices, one-based start columns, and shallow value-independent AST shape fingerprints so downstream analyzers can reuse parser mechanics without reimplementing traversal plumbing
    • fix PHP 8.5 relative self / parent / static type preservation so lexical AST types win only when AST evidence exists, while pure Reflection stays honest
    • fix inheritdoc merging when no parent class exists by avoiding null parent lookups
    Open source →
  2. 0.22.2 05 Aug 2026
    Release notes

    Document the behaviour changes since 0.22.1 in the changelog and add the
    tests that prove nothing else changed.

    The behaviour delta was measured by diffing the full parsed model of a
    433-file corpus (synthetic syntax fixtures, nikic/php-parser and
    phpdocumentor) between 0.22.1 and HEAD. Exactly three changes showed up,
    all of them intended:

    • reflected property/parameter types are now consistently fully
      qualified (\Psr\Container\ContainerInterface instead of
      Psr\Container\ContainerInterface)
    • enum cases no longer leak into PHPEnum::$constants
    • PHPEnum::$is_final / $is_abstract / $is_anonymous are no longer
      null for enums that cannot be autoloaded

    New tests:

    • ReflectionTypeFormattingRegressionTest: pins the rendered type strings
      for the AST path and the reflection path and asserts they agree, plus
      the no-autoload guarantee
    • PublicApiSurfaceTest: snapshot of every public property and method, so
      a removal or an incompatible signature change fails the build
    • ModelInvariantsRegressionTest: parses the whole library and every
      fixture and checks the model invariants, including that class-like
      types are always fully qualified
    • ParserEntryPointsTest: end-to-end coverage of getAstFromFile(),
      getFileInfoFromFile(), the container setters and getFunctionsInfo(),
      which had no test before
    • PHPEnumRegressionTest / AutoloadSafetyRegressionTest: extended to all
      three enum read paths and to the shared autoload guard

    All new tests fail against 0.22.1 and pass on both nikic/php-parser v4
    and v5.

    Also widen the extractHooksFromReflection() array key type, which
    phpstan rejected on PHP 8.4 because getHooks() is keyed by name.

    Co-Authored-By: Claude Opus 5 [email protected]

    Open source →
    Release notes
    • BREAKING (output only): PHPProperty::$type / PHPParameter::$type read via reflection are now consistently fully qualified, e.g. Psr\Container\ContainerInterface is now reported as \Psr\Container\ContainerInterface. Previously the leading \ was only added when class_exists() happened to be true, so interfaces, enums-in-unloadable-files and any not-yet-autoloadable class silently lost it, while the AST path always emitted it. Both paths now agree. Consumers that compare these strings verbatim have to expect the leading \ (built-in types, self, parent, static and intersection types are unchanged)
    • BREAKING (output only): enum cases no longer show up in PHPEnum::$constants; they were already available (with more detail) via $cases / $caseDetails
    • fix: formatting a reflected property/parameter type no longer autoloads the referenced class, which could fatal when that class uses syntax the current runtime cannot compile
    • fix: PHPEnum read from a plain ReflectionClass (which is what Utils::createClassReflectionInstance() returns) now reports $scalarType and $cases / $caseDetails; before, that data was only filled in when a ReflectionEnum was passed explicitly
    • fix: PHPEnum::$is_final / $is_abstract / $is_anonymous now always reflect the language guarantees (true / false / false) instead of staying null when the enum could not be autoloaded
    • fix: traits with constants use the shared PHP-version autoload guard again, so the runtime-compatibility check is identical for classes, interfaces, traits and enums
    • add regression coverage for all of the above, plus a public-API surface test, model invariants over the whole code base and end-to-end coverage of every PhpCodeParser entry point
    Open source →
  3. 0.22.1 13 Jul 2026
    Release notes

    Co-Authored-By: Claude Sonnet 5 [email protected]

    Open source →
    Release notes
    • fix: reflecting/parsing a private or protected class constant referenced from outside its declaring class (via constant() / ReflectionParameter::getDefaultValue()) threw an uncaught \Error and aborted the whole parse; now recovered gracefully
    • fix: PHPConst reflection path assigned an unnormalized gettype() string (e.g. 'NULL' instead of 'null') when a constant's value couldn't be resolved
    • add regression coverage for parsing/reflecting code that references private/protected constants across class boundaries
    • fix: phpstan dead-catch false positive on the \Error catch around ReflectionParameter::getDefaultValue() (its stub only declares \ReflectionException, but it also throws \Error at runtime for this case)
    Open source →
  4. 0.22.0 10 Jul 2026
    Release notes

    [+]: Add support for source-range information and enhance PHP model e…

    Open source →
    Release notes
    • add source-range info to every model element: endLine, startFilePos, endFilePos (byte offsets), enabling precise sed/byte-range reads of a single declaration without loading the whole file
    • add PHPFileInfo + PhpCodeParser::getFileInfoFromFile() for a lightweight per-file summary (namespaces, imports, declares)
    • add PhpCodeParser::getAstFromFile() / getAstFromString() to expose the names-resolved php-parser AST directly for syntax outside the compact Model API
    • add import-aware, resolved phpdoc types via PhpDocContextConnector: typeFromPhpDocResolved / returnTypeFromPhpDocResolved resolve aliased class names (e.g. use Vendor\Payload as Message;) without touching legacy rendered fields
    • add $traitUses / $traitAdaptations (aliasing, insteadof) to class-like models; interfaces now retain all declared parent interfaces
    • add $throws (from @throws), is_returned_by_ref, and (for methods) is_abstract to function/method models; add is_promoted to parameters
    • add PHPEnumCase + $caseDetails on PHPEnum for source-aware, attribute-aware enum cases, alongside the existing legacy $cases value map
    • fix: only the first property in a multi-property declaration (e.g. public $a, $b;) was parsed; all properties in the group are now read
    • add extensive regression coverage for the above
    Open source →
  5. 0.21.0 21 Apr 2026
    Release notes

    [*]: update the changelog

    Open source →
    Release notes
    • BREAKING: runtime support now requires PHP >= 8.1 (instead of PHP >= 7.4), while the parser still analyzes older PHP source syntax from PHP 5.3 through PHP 8.5
    • add broad PHP 8.x syntax and metadata support, including enums, attributes, typed constants, readonly / promoted properties, #[\Override], and property hooks with asymmetric visibility
    • improve phpdoc parsing and recovery for malformed docs, modern type syntax, inherited annotations, and raw @param / @return preservation
    • modernize parser compatibility and dependencies: support nikic/php-parser v4.18 and v5, update phpDocumentor / phpdoc-parser / phpunit / phpstan dependencies, and replace React-based file reads
    • improve autoloading and reflection safety for version-specific syntax and better file read error reporting
    • add extensive regression coverage plus feature validation for analyzable PHP source syntax from PHP 5.3 through PHP 8.5
    Open source →
  6. 0.20.1 13 Aug 2023
    Release notes

    [+]: use "phpstan/phpdoc-parser" for more phpdocs + more tests

    Open source →
    Release notes
    • use "phpstan/phpdoc-parser" for more phpdocs
    Open source →
  7. 0.20.0 31 Jul 2023
    Release notes

    [*]: update the changelog

    Open source →
    Release notes
    • add support for "readonly" properties
    • replace deprecated "parts" property from nikic/PHP-Parser
    • use "phpstan/phpdoc-parser" as fallback for parameters e.g. for callable() types
    • use php types
    • add more tests
    Open source →
  8. 0.19.6 23 Sep 2022
    Release notes

    [*]: update the changelog

    Open source →
    Release notes
    • try to fix autoload #11
    • inheritDoc: use all types (not only from phpdoc) from parent classes & interfaces
    • add more tests
    Open source →
  9. 0.19.5 29 Aug 2022
    Release notes

    [*]: update the changelog

    Open source →
    Release notes
    • support for "::class" from PHP 8
    Open source →
  10. 0.19.4 29 Aug 2022
    Release notes

    [*]: update the changelog

    Open source →
    Release notes
    • fix fatal error for non existing classes
    Open source →
  11. 0.19.3 27 Aug 2022
    Release notes
    • update "phpdocumentor/type-resolver" (with support for int-ranges)
    • clean-up some errors reported by phpstan
    Open source →
  12. 0.19.2 15 Feb 2022
    Release notes
    • quick-fix for missing namespaces in types
    Open source →
  13. 0.19.1 15 Feb 2022
    Release notes
    • optimize NULL detecting from reflection for types
    • "BasePHPClass" -> add more information from reflection
    • "PHPConst" -> add "visibility"
    Open source →
  14. 0.19.0 02 Feb 2022
    Release notes
    • use native php reflection, instead of (slower) better reflection
    • remove "react/filesystem" (not working with phar files)
    Open source →
  15. 0.18.2 29 Nov 2021
    Release notes
    • temporary fix for phpdoc like int<0,1>
    • update dependencies
    Open source →
  16. 0.18.0 03 Oct 2021
    Release notes
    • update dependencies
    Open source →
  17. 0.17.0 26 Jul 2021
    Release notes
    • update dependencies
    Open source →
  18. 0.16.6 26 Dec 2020
    Release notes
    • "PhpCodeParser" -> optimize exception handling of "amphp/parallel" for async code analysis per file
    Open source →
  19. 0.16.5 26 Dec 2020
    Release notes
    • "PhpCodeParser" -> ignore exceptions from auto loaded external classes
    Open source →
  20. 0.16.4 18 Nov 2020
    Release notes
    • "PhpCodeParser" -> allow different file extensions
    Open source →
  21. 0.16.3 30 Oct 2020
    Release notes
    • fix php variable detection
    Open source →
  22. 0.16.2 30 Oct 2020
    Release notes
    • save the raw phpdoc for "@return" and "@param" v2
    Open source →
  23. 0.16.1 30 Oct 2020
    Release notes
    • save the raw phpdoc for "@return" and "@param"
    Open source →
  24. 0.16.0 30 Oct 2020
    Release notes
    • support for modern phpdocs for "@param" and "@return"
    Open source →
  25. 0.15.3 07 Oct 2020
    Release notes
    • update vendor libs
    • PHP 7.2 as minimal requirement
    • remove custom PseudoTypes for phpDocumentor (PseudoTypes are now build in into phpDocumentor itself)
    • add more tests
    Open source →
  26. 0.15.2 04 Sep 2020
    Release notes
    • save special phpdoc @tags and the content of these tags
    Open source →
  27. 0.15.1 04 Sep 2020
    Release notes
    • optimize performance via static cache
    Open source →
  28. 0.15.0 31 Aug 2020
    Release notes
    • move "PhpCodeChecker" in a separate repository
    • move "PhpCodeDumpApi" in a separate repository
    • clean-up vendor dependencies
    Open source →
  29. 0.14.0 22 Aug 2020
    Release notes
    • "PhpCodeCheckerCommand" -> allow to exclude some files
    • optimize parallel execution (cpu cores === max parallel executions)
    • update vendor (phpdocumentor & better-reflection)
    Open source →
  30. 0.13.2 06 Aug 2020
    Release notes
    • "PhpCodeParser" -> add "getFromClassName()"
    Open source →
  31. 0.13.0 18 Jul 2020
    Release notes
    • "PHPTrait" -> add support for "Trait"-files
    Open source →
  32. 0.12.0 04 Jul 2020
    Release notes
    • "PhpCodeParser" -> fix cache key
    • "PhpCodeChecker" -> fix the autoloader parameter
    Open source →
  33. 0.11.0 17 Jun 2020
    Release notes
    • "PHPInterface" -> fix recursion
    • "PhpCodeParser" -> analyse only ".php" files in the given path
    Open source →
  34. 0.10.0 17 Jun 2020
    Release notes
    • "PhpCodeParser" -> ignore errors outside the current file-path-scope
    • "PhpCodeParser" -> use more generic autoloader logic
    • "PhpCodeChecker" -> fix more inheritdoc errors
    Open source →
  35. 0.9.0 16 Jun 2020
    Release notes
    • "PhpCodeChecker" -> check wrong phpdocs from class properties
    • "PhpCodeParser" -> allow to exclude some files
    Open source →
  36. 0.8.0 15 Jun 2020
    Release notes
    • replace PhpReflection with BetterReflection v2
    • fix bugs reported by PhpStan & PhpCodeCheck
    Open source →
  37. 0.7.0 02 Jun 2020
    Release notes
    • replace PhpReflection with BetterReflection
    Open source →
  38. 0.6.0 25 May 2020
    Release notes
    • "PhpCodeParser" -> fetch phpdoc-data for @inheritdoc
    Open source →
  39. 0.5.0 24 May 2020
    Release notes
    • "ParserErrorHandler" -> show more parsing errors in the results
    • "PHPInterface" -> fix PhpReflection usage
    Open source →
  40. 0.4.2 23 May 2020
    Release notes
    • "PhpCodeCheckerCommand" -> fix "$skipMixedTypesAsError" usage
    Open source →
  41. 0.4.1 23 May 2020
    Release notes
    • "PHPFunction" -> fix phpdoc parsing error
    Open source →
  42. 0.4.0 22 May 2020
    Release notes
    • add default values for parameter and properties
    • add types from default values
    • normalize types (e.g. double => float)
    Open source →
  43. 0.3.0 21 May 2020
    Release notes
    • "PHPClass" fix phpdoc
    • add "PhpCodeChecker"-class
    Open source →
  44. 0.2.1 20 May 2020
    Release notes
    • fix code issues reported by psalm + phpstan
    Open source →
  45. 0.2.0 18 May 2020
    Release notes
    • use "amphp/parallel" for async code analyse per file
    Open source →
  46. 0.1.0 13 May 2020
    Release notes
    • init (forked from "JetBrains/phpstorm-stubs")
    • add "PHPProperties"
    • add "PHP Reflection" AND / OR "nikic/PHP-Parser"
    • get phpdocs types via phpDocumentor (+ psalm)
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive