Skip to content

Commit

Permalink
Improved docs, removed support for older php versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
alrik11es committed Aug 25, 2016
1 parent 94c9395 commit 080dc10
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 10 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 6
- 7
- hhvm

Expand Down
70 changes: 66 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@
Do you remember classic linux Cowsay? Well this is a port for PHP if you want lovely cows everywhere in your terminal
apps.

Now supporting more animals in the farm.

## Install

Via Composer

``` bash
$ composer require alrik11es/cowsayphp
```
Requires PHP >=5.6

## Usage
## Using

``` php
use Cowsayphp\Cow;
use Cowsayphp\Farm;

echo '<pre>'.Cow::say("Ohmg I'm a cow!").'</pre>';
$cow = Farm::create(\Cowsayphp\Farm\Cow::class);
echo '<pre>'.$cow->say("Ohmg I'm a cow!").'</pre>';
```

The result:
Expand All @@ -35,10 +39,68 @@ The result:
||----w |
|| ||

### Other animals

_\Cowsayphp\Farm\Whale::class_

< hello I'm a whale! >
\
\ ## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/

_\Cowsayphp\Farm\Dragon::class_

< Dragon! >
\ / \ //\
\ |\___/| / \// \\
/0 0 \__ / // | \ \
/ / \/_/ // | \ \
@_^_@'/ \/_ // | \ \
//_^_/ \/_ // | \ \
( //) | \/// | \ \
( / /) _|_ / ) // | \ _\
( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\ / ~-. _ .-~ .-~^-. \
(( /// )) `. { } / \ \
(( / )) .----~-.\ \-' .~ \ `. \^-.
///.----..> \ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
_\Cowsayphp\Farm\Tux::class_

< Tux present! >
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/


## Deprecated use

This will be deprecated in future versions. But still works.

``` php
use Cowsayphp\Cow;

echo '<pre>'.Cow::say("Ohmg I'm a cow!").'</pre>';
```

## Testing

``` bash
$ phpunit
$ ./bin/phpunit
```

## Contributing
Expand Down
5 changes: 5 additions & 0 deletions bin/cowsayphp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env php
<?php
/**
* This terminal program has been done for testing purposes, but if someone needs it could be improved via pull-requests
*/

if (extension_loaded('phar') && ($uri = Phar::running())) {
require "$uri/src/vendors/autoload.php";
} elseif (class_exists('Extract')) {
Expand All @@ -9,6 +13,7 @@ if (extension_loaded('phar') && ($uri = Phar::running())) {
}

if(count($argv) > 1){
// Todo: Create a way to select the animal from the terminal
$cow = \Cowsayphp\Farm::create(\Cowsayphp\Farm\Cow::class);
echo $cow->say($argv[1]);
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php" : ">=5.3.0"
"php" : ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit" : "5.*",
Expand Down
2 changes: 1 addition & 1 deletion src/Cow.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Cow
{
public static function say($text)
{
$cow = Farm::create('\Cowsayphp\Farm\Cow'); // @todo: Deprecate support for php <=5.5 \Cowsayphp\Farm\Cow::class
$cow = Farm::create(\Cowsayphp\Farm\Cow::class);
return $cow->say($text);
}
}

0 comments on commit 080dc10

Please sign in to comment.