Gipetto/CowSay

Release Version Packagist Version Build Status Moo, Cow

GitHub icon View on Github

An extensible PHP port of the Linux Cowsay utility.

Requirements

CowSay will update to stay in step with the latest, actively supported PHP version. See the official PHP list of supported versions.

QuickStart

Install

$ composer require Gipetto/CowSay

Usage

MyCow.php
 
<?php use CowSay\Cow; $bessie = new Cow("Hello, Farm!"); // store the output in a variable $output = $bessie->say(); echo $output; // or just echo the object for direct output echo $bessie;

Additional Docs

Carcasses

\CowSay\Bear

  -------------------------------
/ How now brown \CowSay\Bear.     \
| I support the following Traits: |
\  • Eyes                         /
  -------------------------------
     \
      \ _     _
       (o\---/o)
        ( . . )
       _( (T) )_
      / /     \ \
     / /       \ \
     \_)       (_/
       \   _   /
       _)  |  (_
      (___,'.___)
            

\CowSay\BorgCow

  -------------------------------
/ How now brown \CowSay\BorgCow.  \
| I support the following Traits: |
|  • Eyes                         |
|  • Tongue                       |
|  • Udder                        |
\  • Poop                         /
  -------------------------------
          \   ^__^
           \  (==)\_______
              (__)\       )\/\
                  ||----w |
                  ||     || oOo
            

\CowSay\Cow

  -------------------------------
/ How now brown \CowSay\Cow.      \
| I support the following Traits: |
|  • Eyes                         |
|  • Tongue                       |
|  • Udder                        |
\  • Poop                         /
  -------------------------------
          \   ^__^
           \  (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     || oOo
            

\CowSay\CrazyCow

  -------------------------------
/ How now brown \CowSay\CrazyCow. \
| I support the following Traits: |
|  • Eyes                         |
|  • Tongue                       |
|  • Udder                        |
\  • Poop                         /
  -------------------------------
          \   ^__^
           \  (oO)\_______
              (__)\       )\/\
               U  ||----w |
                  ||     || oOo
            

\CowSay\GreedyCow

  --------------------------------
/ How now brown \CowSay\GreedyCow. \
| I support the following Traits:  |
|  • Eyes                          |
|  • Tongue                        |
|  • Udder                         |
\  • Poop                          /
  --------------------------------
          \   ^__^
           \  ($$)\_______
              (__)\       )\/\
                  ||----w |
                  ||     || oOo
            

\CowSay\ParanoidCow

  ----------------------------------
/ How now brown \CowSay\ParanoidCow. \
| I support the following Traits:    |
|  • Eyes                            |
|  • Tongue                          |
|  • Udder                           |
\  • Poop                            /
  ----------------------------------
          \   ^__^
           \  (@@)\_______
              (__)\       )\/\
                  ||----w |
                  ||     || oOo
            

\CowSay\Sheep

  ----------------------------
/ How now brown \CowSay\Sheep. \
\ I don't support any Traits.  /
  ----------------------------
    \
     \
       __
      UooU\.'@@@@@@`.
      \__/(@@@@@@@@@@)
           (@@@@@@@@)
           `YY~~~~YY'
            ||    ||
            

\CowSay\SurprisedCow

  -----------------------------------
/ How now brown \CowSay\SurprisedCow. \
| I support the following Traits:     |
|  • Eyes                             |
|  • Tongue                           |
|  • Udder                            |
\  • Poop                             /
  -----------------------------------
          \   ^__^
           \  (OO)\_______
              (__)\       )\/\
                  ||----w |
                  ||     || oOo
            

\CowSay\Tux

  ---------------------------
/ How now brown \CowSay\Tux.  \
\ I don't support any Traits. /
  ---------------------------
     \
      \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/
            

\CowSay\YouthfulCow

  ----------------------------------
/ How now brown \CowSay\YouthfulCow. \
| I support the following Traits:    |
|  • Eyes                            |
|  • Tongue                          |
|  • Udder                           |
\  • Poop                            /
  ----------------------------------
          \   ^__^
           \  (..)\_______
              (__)\       )\/\
               U  ||----w |
                  ||     || oOo
            

Notes

Multi-byte strings:

Multi-byte strings may have line length calculation issues
when combined with single byte characters, but shouldn't break…

  --------------------------------------------------
/ UTF8 will                                          \
| truncate                                           |
| to 10                                              |
| chars.                                             |
| Other byte                                         |
| lengths                                            |
| won't.                                             |
| 现在怎么棕色的牛。这不是多字节字符串的精彩演示吗? |
| 现在怎么棕色的牛。这不是多字节字符串的精彩演示吗? |
\ 现在怎么棕色的牛。这不是多字节字符串的精彩演示吗? /
  --------------------------------------------------
          \   ^__^
           \  (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||