Download the PHP package petk/normalizator without Composer

On this page you can find all versions of the php package petk/normalizator. 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 normalizator

Normalizator

Test workflow

Command line tool written in PHP that checks and fixes trailing whitespace, LF or CRLF newline characters, redundant trailing final newlines, file permissions and similar in given files.

Features

Installation

Normalizator is a simple Phar executable file that can be downloaded from GitHub:

Or:

By moving it to /usr/local/bin it can be accessed accross your system:

Update

Update normalizator to the latest version:

About

There is a recurring and never-ending issue in many code projects with trailing whitespace, missing final newlines at the end of the files, too many redundant newlines, different end of line characters, misused permissions and similar.

Beside the multiple preferred coding styles, also certain editors behave differently and some automatically fix these when saving files. Some utilize .editorconfig file by default and some leave files intact.

Git also provides several configuration options to detect and deal with these issues.

Although it is not mandatory for all files to have these issues fixed, a more consistent and homogeneous approach brings less cognitive load in commits and a better development experience in certain text editors and IDEs.

This tool aims to bring an initial solution to this issue and provides a more consistent set of source code files across the code repository with a simplistic yet still useful and powerful enough approach to tidy all files in a given Git repository, directory, or a path using command line.

Docker

There is also a Docker image available to run the tool inside a container:

Requirements

To use normalizator, system needs to have PHP 8.2 or greater installed with the following PHP extensions:

Usage

Check files (dry run) without modifying any file:

Fix and overwrite files:

Passing paths

Paths or files can be passed as a space separated arguments:

The --not option skips given paths or files:

File encoding

For non-ASCII and non-UTF-8 file encodings, option --encoding or short -c tries to convert file content encoding to UTF-8:

See also:

Trailing whitespace

Normalizator can trim trailing whitespace characters in text files:

To fix files:

Indentation style

Indentation style can be checked with:

Indentation size is set to 4 (one tab equals to 4 spaces). Indentation size can be changed with the --indentation-size option. For example, the following will set indentation size to 2:

Space before tab

To clean all spaces before tabs in the indentation:

EOL normalization

This normalizes the EOL (end of line) style (LF vs CRLF):

According to POSIX, a line is a sequence of zero or more non-<newline> characters plus a terminating <newline> character. Files should normally have at least one final newline character.

C89 standard and above mention a final newline:

A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character.

Newline characters:

It is possible to set EOL character with the eol Git attribute if some files require specific EOL:

Normalizator will take the Git attribute setting into account.

To override the EOL characters for all files in the given path:

Redundant leading EOL

Final EOL normalization

Optionally, you can set the maximum number of allowed final EOLs by passing a number. In case of a missing final EOL, one will be appended. This will allow up to 2 final EOLs:

Redundant middle EOL

To trim redundant EOLs in the middle of the text or code:

Permissions normalization

This syncs permissions of given files and directories. Symbolic links are not affected.

This mostly applies for *nix systems.

Permissions in the .git directory:

On systems with umask 002 (Ubuntu) these permissions are off by 2. So they are a bit more relaxed and defaults are:

File extension normalization

To normalize file extensions:

This will adjust file extensions, for example from .JPEG to .jpg and similar.

Filename normalization

To normalize names of files and directories:

This fixes names of files and directories so that they don't contain whitespaces or special characters that might cause issues in certain occassions.

Documentation

License and contributing

Contributions are welcome by forking the repository on GitHub. This repository is released under the MIT license.


All versions of normalizator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-fileinfo Version *
ext-filter Version *
ext-intl Version *
ext-mbstring Version *
ext-phar Version *
psr/container Version ^2.0
psr/event-dispatcher Version ^1.0
psr/simple-cache Version ^3.0
symfony/console Version ^7.0
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 petk/normalizator contains the following files

Loading the files please wait ....