Download the PHP package liquidrazor/class-locator without Composer
On this page you can find all versions of the php package liquidrazor/class-locator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liquidrazor/class-locator
More information about liquidrazor/class-locator
Files in liquidrazor/class-locator
Package class-locator
Short Description Minimal deterministic class discovery and validation library for PHP 8.3+.
License MIT
Homepage https://github.com/LiquidRazor/ClassLocator
Informations about the package class-locator
LiquidRazor ClassLocator
A minimal PHP 8.3+ library for deterministic class discovery and validation.
What it does
- Uses
liquidrazor/file-locatorto discover PHP files - Maps file paths → FQCN using PSR-4 rules
- Validates that your codebase matches its declared structure
- Exposes structural symbol metadata from declared symbols when declaration validation runs
That’s it.
Philosophy
- Filesystem is truth
- Deterministic mapping over guesswork
- Validation is explicit, not implicit
- No magic, no hidden loading
- Built for real-world broken projects
Dependency Model
ClassLocator is built on top of:
liquidrazor/file-locator
It does NOT define roots.
It consumes whatever FileLocator provides.
Namespace Resolution
ClassLocator does NOT detect namespaces for discovery.
Instead:
- Namespace roots are loaded from the target project's
composer.json(PSR-4) - File paths are mapped deterministically to expected FQCN
- Namespace parsing is used for validation and structural metadata extraction when enabled by mode
Filesystem + Composer define expectation.
Files must comply.
Modes
ENFORCING (default)
- Requires valid Composer PSR-4 mappings
- Validates all files
- Extracts structural metadata from declared symbols
- Throws on critical violations
- Fails fast on broken structure
STRICT
- Validates all files
- Extracts structural metadata from declared symbols
- Collects violations
- Does not throw
LENIENT
- Best-effort discovery
- Skips invalid entries
- Skips declaration validation
- Returns unresolved structural metadata instead of guessing
Validation
Validation compares:
expected (path + composer)
vs
actual (file namespace + symbol)
Detects:
- Namespace mismatch
- Class/interface/trait/enum mismatch
- Files outside PSR-4 scope
- Duplicate FQCN
- Missing or invalid Composer mappings
Usage
Public API
ClassLocator
Mode (enum)
LocateResult
SymbolKind (enum)
SymbolKind::CLASS_ uses a trailing underscore because CLASS collides with PHP's ::class constant syntax.
ClassInfo
In ENFORCING and STRICT, ClassInfo metadata is derived from the declared symbol in the source file.
In LENIENT, declaration parsing is skipped, so:
getSymbolKind()returnsnullgetImplementedInterfaces()returns[]getParentClass()returnsnullisAbstract()returnsnullisFinal()returnsnullhasResolvedMetadata()returnsfalse
Violation
Example: Inspect Structural Metadata
Responsibility Boundary
ClassLocator exposes structural symbol metadata.
It still does NOT:
- classify framework concepts
- register services
- detect event semantics
- manipulate autoloading
- execute discovered files
Downstream tools may use the exposed metadata for their own classification or validation logic.
Summary
Give it a FileLocator.
It gives you deterministic classes, structural violations, and source-derived symbol metadata when validation is enabled.