Download the PHP package dtl/class-to-file without Composer
On this page you can find all versions of the php package dtl/class-to-file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dtl/class-to-file
More information about dtl/class-to-file
Files in dtl/class-to-file
Package class-to-file
Short Description Library to covert class names to file paths and vice-versa
License MIT
Informations about the package class-to-file
Class To File Transformer
This library provides facilities to guess/transform class names to files paths and vice-versa.
It uses the composer autoload to guess the best candidates using PSR-0 and PSR-4.
Usage
Doesn't composer provide file paths for classes?
Yes it does, but only if the class exists. One of the purposes of this class is to be able to determine a file path for a class which may not exist (for example to generate a class in a new file).
You may also want to do this and not pollute your autoloading environment (unfortunately this library currently does pollute the autoloader, but it can be avoided in the future.
Why would you want to determine the class from a filename?
Glad you asked! This is can be useful when you want to generate an empty class in an empty file.
When one autoloader isn't enough
In some exceptional cases you may have a project which has more than one
composer autoloader, this is supported through the ChainFileToClass
and
ChainClassToFile
classes, or most simply through the facade:
Contributing
This package is open source and welcomes contributions! Feel free to open a pull request on this repository.
Support
- Create an issue on the main Phpactor repository.
- Join the
#phpactor
channel on the Slack Symfony Devs channel.
All versions of class-to-file with dependencies
symfony/filesystem Version ^4.2 || ^5.0 || ^6.0
psr/log Version ^1.0 || ^2.0 || ^3.0