PHP Classes
elePHPant
Icontem

PHP EOL Conversion: Convert the end of line characters of given files

Recommend this page to a friend!
  Info   View files Example   View files View files (19)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-02-28 (7 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
peol 1.0GNU General Publi...5PHP 5, Files and Folders, Conversion, C...
Description Author

This package can convert the end of line characters of given files.

It can take a list of files and convert the end of line characters to a specified end of line convention.

For Windows it converts \r\n for Windows, \n for Linux and \r for Mac.

  Performance   Level  
Name: Michael Cummings <contact>
Classes: 5 packages by
Country: United States United States
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Details

Peol

Php End Of Line is a group of Non-OS specific PHP commands to change line endings on text files.

Why Peol

Since I do development in Windows as well as Linux systems I needed a cross-platform way to insure that line ending are set correctly in my projects. Most of the time my IDE does things right but there's time I'll NOT notice it used LF Unix type endings say in a README file which does need to be in Windows (DOS) CR-LF format or used them in PHP which I prefer to have in LF instead.

Differences in line endings can also cause issues with VCS if NOT handled correctly as well. In Linux it's no problem to fix a file or even a group of them using the dos2unix and unit2dos commands in CLI but it's more of an issue in Windows since it does NOT have those utils. Add to that I've been wanting to learn more about Symfony's Console and this project was born.

Installing

Peol uses Composer and is up on Packagest so if you also use Composer in your project you can just add it. If you do NOT use Composer in your project you can still use it to install Peol. First you'll need to install Composer somewhere which you can get at https://getcomposer.org/. Once you have composer.phar file you can just put it in the directory you want to install Peol to and add a copy of the composer.json file from GitHub there as well. Once you have both files in the directory you can run `php -f "composer.phar" install -o --no-dev`. This should setup Peol so you can use it.

Using

Using Peol is easy for example to change the line endings of all the txt files in the current directory to Windows (DOS):

php -f where/i/installed/it/bin/peol EolToWin *.txt

For more information on using Peol try `php -f where/i/installed/it/bin/peol list`.

Future

In the future I'll probably add ability to use shell type glob paths as well but I run into a few snags adding that and decided that for now it'll do what I need and I've been neglecting my other projects long enough working on it. I included in the project some WIP on that so if someone else wants to pick it up and finish it they can.

  Files folder image Files  
File Role Description
Files folder imagebin (1 file)
Files folder imagelib (4 directories)
Accessible without login Plain text file .mailmap Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  bin  
File Role Description
  Accessible without login Plain text file peol Example Example script

  Files folder image Files  /  lib  
File Role Description
Files folder imageCommand (4 files)
Files folder imageConverter (4 files)
Files folder imageException (4 files)
Files folder imageExtractor (2 files)

  Files folder image Files  /  lib  /  Command  
File Role Description
  Plain text file AbstractConverterCommand.php Class Class source
  Plain text file ToOldMacCommand.php Class Class source
  Plain text file ToUnixCommand.php Class Class source
  Plain text file ToWinCommand.php Class Class source

  Files folder image Files  /  lib  /  Converter  
File Role Description
  Plain text file Converter.php Class Class source
  Plain text file converterInterface.php Class Class source
  Plain text file GlobFilterIterator.php Class Class source
  Plain text file GlobPathIterator.php Class Class source

  Files folder image Files  /  lib  /  Exception  
File Role Description
  Plain text file PeolEolException.php Class Class source
  Plain text file PeolException.php Class Class source
  Plain text file PeolFileException.php Class Class source
  Plain text file PeolPathException.php Class Class source

  Files folder image Files  /  lib  /  Extractor  
File Role Description
  Plain text file ExtractorInterface.php Class Class source
  Plain text file Git.php Class Class source

 Version Control Unique User Downloads  
 100%
Total:0
This week:0
User Comments (1)
nice
-7 hours ago (muabshir)
-