2017 © Pedro Peláez
 

library ph

Heredoc alternative for text.

image

sadovnik/ph

Heredoc alternative for text.

  • Monday, December 5, 2016
  • by sadovnik
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

pretty heredoc

Build Status Code Climate Test Coverage Issue Count, (*1)

It's painful to write heredocs in the middle of some indentation level:, (*2)

class CliApp
{
    public static function printUsage()
    {
        echo <<<EOL
Usage:
    linter [--fix] [--debug] <path>
    linter (-h | --help)
    linter --version
EOL;
    }
}

Ruby has smart heredocs that respect indentation:, (*3)

class CliApp
  def self.print_usage
    puts <<~EOL
      Usage:
          linter [--fix] [--debug] <path>
          linter (-h | --help)
          linter --version
    EOL
  end
end

But PHP has not., (*4)

So I made a basic function that receives string and strips it:, (*5)


use function Sadovnik\PrettyHeredoc\ph as ✍️; class CliApp { public static function printUsage() { echo ✍️(' Usage: linter [--fix] [--debug] <path> linter (-h | --help) linter --version '); } }

Enjoy it!, (*6)

Install

Via Composer:, (*7)

composer require sadovnik/ph

⚓️, (*8)

The Versions

05/12 2016

dev-master

9999999-dev

Heredoc alternative for text.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Cyril Sadovnik

05/12 2016

1.0.0

1.0.0.0

Heredoc alternative for text.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Cyril Sadovnik