PHP Classes

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 (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 53%Total: 93 All time: 9,819 This week: 134Up
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.

Innovation Award
PHP Programming Innovation award nominee
March 2017
Number 5
Text files created in different operating systems use different sequences of characters to break the text lines.

This package can read text files and convert end of line character sequences between different operating system conventions.

Manuel Lemos
Picture of Michael Cummings
  Performance   Level  
Name: Michael Cummings <contact>
Classes: 9 packages by
Country: United States United States
Age: ???
All time rank: 1903263 in United States United States
Week rank: 76 Up8 in United States United States Up
Innovation award
Innovation award
Nominee: 7x

Winner: 1x

Example

#!/usr/bin/env php
<?php
/**
 * Contains PhpEOL cli console.
 *
 * PHP version 5.3
 *
 * LICENSE:
 * This file is part of PhpEOL which is a simple Non-OS specific PHP script to
 * change line endings on a group of files.
 * Copyright (C) 2014 Michael Cummings
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * You should be able to find a copy of this license in the LICENSE.md file. A copy of the GNU GPL should also be
 * available in the GNU-GPL.md file.
 *
 * @copyright 2014 Michael Cummings
 * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
 * @author Michael Cummings <mgcummings@yahoo.com>
 */
namespace peol;

/*
 * Find auto loader from one of
 * vendor/bin/
 * OR ./
 * OR bin/
 * OR lib/PhpEOL/
 * OR vendor/PhpEOL/PhpEOL/bin/
 */
(@include_once dirname(__DIR__) . '/autoload.php')
|| (@include_once
__DIR__ . '/vendor/autoload.php')
|| (@include_once
dirname(__DIR__) . '/vendor/autoload.php')
|| (@include_once
dirname(dirname(__DIR__)) . '/vendor/autoload.php')
|| (@include_once
dirname(dirname(dirname(__DIR__))) . '/autoload.php')
|| die(
'Could not find required auto class loader. Aborting ...');
use
peol\Command\ToOldMacCommand;
use
peol\Command\ToUnixCommand;
use
peol\Command\ToWinCommand;
use
peol\Converter\Converter;
use
Symfony\Component\Console\Application;

$cwd = getcwd();
$converter = new Converter();
$application = new Application('Php End Of Line (peol) Converter', '0.0.1');
$application->add(new ToUnixCommand('EolToUnix', $cwd, $converter));
$application->add(new ToWinCommand('EolToWin', $cwd, $converter));
$application->add(new ToOldMacCommand('EolToOldMac', $cwd, $converter));
$application->run();


  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 Download Rankings  
 100%
Total:93
This week:0
All time:9,819
This week:134Up
User Ratings User Comments (3)
 All time
Utility:62%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:75%StarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:53%StarStarStar
Rank:2038
 
This is brilliant example of senceless OOP.
6 years ago (Alexey Musienko)
15%Star
This is brilliant example of senceless OOP.
6 years ago (Alexey Musienko)
15%Star
nice
6 years ago (muabshir)
80%StarStarStarStarStar