- How do I install Laravie Parser in a Laravel project?
- Install it with Composer using composer require laravie/parser, then verify the package's PHP, Laravel, and nikic/php-parser constraints against your application. Because the repository is unknown, start with an isolated Artisan command, CI script, or queue job rather than integrating it throughout the codebase. Confirm whether Laravel package auto-discovery registers anything or whether explicit service-provider setup is required.
- Does Laravie Parser support Laravel 10, 11, or 12?
- The provided context does not specify a supported Laravel version matrix, so you must check the package's composer.json and release history before adoption. Confirm compatibility with your current Laravel release line and with the nikic/php-parser version already used by other static-analysis or generation packages. Test against representative application files rather than relying on the overview alone.
- What metadata can Laravie Parser extract from a PHP class?
- Laravie Parser is described as extracting class-level metadata from PHP source files, including classes, interfaces, traits, methods, properties, and docblock information. It reads files without loading or autoloading them, which makes it useful for package discovery, code generation, and developer tooling. Keep its AST or metadata objects behind an internal adapter so they do not leak across domain boundaries.
- Do I need to autoload or execute PHP code to parse it with Laravie Parser?
- No. The package is designed to inspect PHP source files without executing or autoloading the parsed classes, which is important for tooling that handles incomplete, generated, or untrusted files. However, you should still handle malformed files, unreadable paths, and parse failures deliberately. Do not assume that every file in a directory will parse successfully.
- Is Laravie Parser a replacement for nikic/php-parser?
- No. Laravie Parser is best understood as a Laravel-friendly convenience wrapper around nikic/php-parser, and the upstream parser remains the critical dependency. If your team needs long-term control over parsing behavior, direct use of nikic/php-parser may be preferable. If you adopt the wrapper, keep a migration path to the underlying parser.
- How should I handle parse errors and unreadable files with Laravie Parser?
- Wrap Laravie Parser behind an internal service that catches exceptions and reports parse failures explicitly instead of silently emitting partial metadata. Validate file paths, permissions, and symlink traversal before parsing directories. Because the documented API surface is limited in the provided context, test error behavior against malformed PHP files and missing paths.
- Can Laravie Parser be used at runtime in HTTP requests?
- Laravie Parser is intended for build-time and developer tooling such as Artisan commands, CI jobs, package discovery, and code generation, not synchronous HTTP request paths. Parsing large ASTs can consume significant memory, so avoid high-frequency runtime parsing. If you must parse during a request, bound the workload and consider moving it to a queue job.
- Does Laravie Parser support PHP 8.3 and 8.4 syntax like enums, attributes, and readonly properties?
- The provided context does not guarantee support for newer PHP syntax, so you must prove compatibility against your project's actual syntax mix. Test enums, attributes, readonly properties, anonymous classes, traits, imports, and generated files before relying on the package. If the wrapper lags behind, check whether the underlying nikic/php-parser version supports the syntax you need.
- Is Laravie Parser actively maintained and production-ready?
- The available details show limited public quality signals, an unknown repository, and modest adoption, so treat Laravie Parser as a convenience layer rather than a strategic platform. Verify license, maintainer activity, release cadence, test coverage, and API documentation before production use. For critical tooling, consider direct nikic/php-parser integration or a maintained fork.
- How do I migrate from Laravie Parser to nikic/php-parser directly?
- Start by placing Laravie Parser behind a small internal interface that returns your own metadata structures rather than package-specific AST objects. If the wrapper becomes unavailable or insufficient, reimplement that adapter with nikic/php-parser directly and compare extracted class, method, property, and import data against expected results. This approach limits migration risk and avoids exposing parser internals throughout the codebase.