|Ratings|| ||Unique User Downloads|| ||Download Rankings|
| 53%||Total: 94 This week: 1||All time: 9,826 This week: 372|
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.
|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.
* Contains PhpEOL cli console.
* PHP version 5.3
* 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
* You should have received a copy of the GNU Lesser General Public License along with this program. If not, see
* 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 <email@example.com>
* Find auto loader from one of
* 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 ...');
$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));
Php End Of Line is a group of Non-OS specific PHP commands to change line endings on text files.
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
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
`php -f "composer.phar" install -o --no-dev
`. This should setup Peol so you can use it.
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
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.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.