Download the PHP package lesphp/psr4-converter without Composer

On this page you can find all versions of the php package lesphp/psr4-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package psr4-converter

PSR-4 Converter

PSR-4 Converter is a tool to automate the conversion of PSR-0 or non-standard codes to PSR-4 compliance codes. To convert the php code (support codebase with PHP >= 5.0), this tool statically parses the code and then all the code is scanned to find the definitions that will be changed. Making legacy code compiler with PSR-4 involves more steps than renaming namespaces, this tool solves the following problems with this conversion:

  1. Ensure that there is only one class per php file;
  2. Possibility of converting names from PSR-0 to PSR-4, converting underscore to namespace;
  3. Prefix existing namespaces with a vendor namespace;
  4. Create class_alias from the old class to the new one to ensure dynamic calls (class reference by variables);
  5. Validation of invalid statements that cannot be converted in php files;
  6. Creating include files with conditional functions and definitions to be included using composer.
  7. Automatic generation of autoload file to load old classes, delivering the new class instead.
  8. Possibility to ignore namespaces and directories.
  9. Creation of a mapping json file, allowing to use it to automate other steps.
  10. Rename all references from the old names to the new class and function names.
  11. Rename all references in DocBlocks from the old names to the new class and function names.
  12. Refactoring the imports to use the new converted names.
  13. Risky conversion alert.
  14. Checksum validation, allowing you to use pre-existing mapping files safely.

Instalation

You can install this library in several ways.

composer

  1. Add the dependency to your composer require lesphp/psr4-converter project. It is recommended to install globally via the command composer require --global lesphp/psr4-converter.

  2. Run the PSR-4 Converter via the command php vendor/bin/psr4-converter help or psr4-converter help if installed globally.

Phive

  1. Install PSR-4 from phive with the command phive install --force-accept-unsigned lesphp/psr4-converter

  2. Run PSR-4 Converter via psr4-converter help command.

Usage

Mapping

The map command will generate a mapping json file containing all the information needed for the conversion, including all old and new name mappings.

For example the above command will generate the mapping file /tmp/.psr4-converter.json with all conversions to the /path/to/source directory, will also:

Use the psr4-converter map --help command to get more details on the arguments and possibilities of the command.

Converting

Using the mapping file it is possible to convert the code to a new directory through the following command.

It will convert the code mapped in /tmp/.psr4-converter.json to the /path/to/destination directory, will also:

Use the psr4-converter convert --help command to get more details on the arguments and possibilities of the command.

Renaming

Using the mapping file it is possible to rename the mapped references, so the old names will be converted to the new names. Use the rename command like this psr4-converter rename /tmp/.psr4-converter.json /path/to/destination. The convert command already renames the converted code, so the rename command is useful only to rename another already existent code.

Use the psr4-converter rename --help command to get more details on the arguments and possibilities of the command.

Inspecting

Using the mapping file it is possible to inspect the mapped changes. Use the inspect command like this psr4-converter inspect /tmp/.psr4-converter.json. Using the option -o names-changes is possible to get a json from changed names.

Use the psr4-converter inspect --help command to get more details on the arguments and possibilities of the command.


All versions of psr4-converter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
nikic/php-parser Version ^4.13
symfony/console Version ^6.0
symfony/finder Version ^6.0
symfony/serializer Version ^6.0
symfony/property-info Version ^6.0
symfony/filesystem Version ^6.0
lesphp/property-info-typed-array Version ^6.0
symplify/astral Version ^10.2
phpstan/phpdoc-parser Version ^1.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lesphp/psr4-converter contains the following files

Loading the files please wait ....