From 348a5c968557cc103c1186a983c6a95df77fe616 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 3 Jan 2019 00:00:04 -0600 Subject: [PATCH] Dropped some stuff, added some stuff --- README.md | 60 ++++++++++++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index fde3c67..7ea594d 100644 --- a/README.md +++ b/README.md @@ -6,33 +6,12 @@ Lorem ipsum generator in PHP without dependencies. Compatible with PHP 5.3+. -## Origins - -Once upon a time, I was attempting to find a lorem ipsum generator over on -[Packagist](https://packagist.org/search/?q=lorem%20ipsum). I was presented with -many options, and some of those options were good. Unfortunately, the bulk of -those options depended on Symphony or the Zend Framework. This wouldn’t have -been a big deal but under the circumstances, I wanted something that was not -tightly coupled to these frameworks because I wanted to use the generator in my -_own_ framework. - -I had decided to use -[badcow/lorem-ipsum](https://packagist.org/packages/badcow/lorem-ipsum) because -it did not have any dependencies nor did it rely on any external APIs. As I -started to use the library, I found that I was going to have to fight with it to -get it to do what I wanted. After digging through the code, I realized that I -was going to end up gutting most of it to bend it to my will. I know when you -overhaul someone’s code the likelihood of them accepting a pull request goes -down dramatically, hence building this library while taking cues from it’s -predecessor. - -Also, the aforementioned package had a bunch of “setter” and “getter” methods -that were grossing me out :scream: +[![Become a Patron](https://joshtronic.com/images/become-patron.png)](https://www.patreon.com/joshtronic) ## Installation The preferred installation method is via `composer`. First add the following to -your `composer.json` +your `composer.json`: ```json "require": { @@ -40,7 +19,7 @@ your `composer.json` } ``` -Then run `composer update` +Then run `composer update`. ## Usage @@ -53,25 +32,25 @@ $lipsum = new joshtronic\LoremIpsum(); ### Generating Words ```php -echo '1 word: ' . $lipsum->word(); +echo '1 word: ' . $lipsum->word(); echo '5 words: ' . $lipsum->words(5); ``` -### Generating sentences +### Generating Sentences ```php -echo '1 sentence: ' . $lipsum->sentence(); +echo '1 sentence: ' . $lipsum->sentence(); echo '5 sentences: ' . $lipsum->sentences(5); ``` -### Generating paragraphs +### Generating Paragraphs ```php -echo '1 paragraph: ' . $lipsum->paragraph(); +echo '1 paragraph: ' . $lipsum->paragraph(); echo '5 paragraphs: ' . $lipsum->paragraphs(5); ``` -### Wrapping text with HTML tags +### Wrapping Text with HTML Tags If you would like to wrap the generated text with a tag, pass it as the second parameter: @@ -98,7 +77,7 @@ echo $lipsum->words(3, '
  • $1
  • '); // Generates:
  • ...
  • ...
  • ...
  • ``` -### Return as an array +### Return as an Array Perhaps you want an array instead of a string: @@ -116,11 +95,9 @@ print_r($lipsum->wordsArray(5, 'li')); ## Assumptions -Instead of having an option as to whether or not a string should start the -generated output with “Lorem ipsum dolor sit amet, consectetur adipiscing elit.” -a few assumptions are baked in. The first string generated will always start -with the traditional “Lorem ipsum…”. Subsequent strings may contain those words -but will not explicitly start with them. +The first string generated will always start with the traditional "Lorem ipsum +dolor sit amet, consectetur adipiscing elit". Subsequent strings may contain +those words but will not explicitly start with them. ## Contributing @@ -129,3 +106,14 @@ pull requests. Unit tests are required for all contributions. You can run the test suite from the `tests` directory simply by running `phpunit .` + +## Credits + +`php-loremipsum` was originally inspired by +[badcow/lorem-ipsum](https://packagist.org/packages/badcow/lorem-ipsum) with a +goal of being a dependency free lorem ipsum generator with flexible generation +options. + +## License + +MIT