gipetto/cowsay

An extensible PHP port of the Cowsay linux utility

1.0.4 2015-11-26 02:46 UTC

README

Release Version Packagist Version Build Status Moo, Cow

An extensible PHP port of the Linux Cowsay utility. This library is not designed for command line use. You should install the original Cowsay for that.

Requirements

  • PHP 5.4+

Install

$ composer require Gipetto/CowSay

Quickstart

$bessie = new Cow('Hello, Farm!');
echo $bessie;

Displays:

  ------------
< Hello, Farm! >
  ------------
          \   ^__^
           \  (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||

Run php demo.php to see all the included cows and their traits.

Traits

Cows support a few traits. You can specify the Eyes, Tongue, Udder and, yes, you can specify Poop.

$bessie = new Cow('Hello, Farm!');
$bessie->setEyes('oO')
    ->setTongue('U')
    ->setPoop('@@@')
    ->setUdder('W');
echo $bessie;

Displays:

  ------------
< Hello, Farm! >
  ------------
          \   ^__^
           \  (oO)\_______
              (__)\       )\/\
               U  ||----W |
                  ||     || @@@

Adding new Carcases

CowSay is easily extended to add new carcases for your custom needs. See the Carcasses tutorial for more information.

License

CowSay is licenced under The MIT License (MIT).