PHP 7.3 and more

* Added CI for PHP 7.3
* Dropped CI for HHVM (was running into too many issues out of no where)
* Reworked CI distros where I could
* Bumped copyright year
* Cleaned up the README, fixed spacing, dumped some of the wordiness
This commit is contained in:
Josh Sherman 2019-01-03 00:21:50 -06:00 committed by GitHub
parent 24b768a630
commit e41f4f7630
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 51 deletions

View file

@ -1,5 +1,5 @@
language: php language: php
dist: trusty dist: bionic
sudo: required sudo: required
matrix: matrix:
@ -7,26 +7,33 @@ matrix:
- php: 5.3 - php: 5.3
dist: precise dist: precise
- php: 5.4 - php: 5.4
dist: trusty
- php: 5.5 - php: 5.5
dist: trusty
- php: 5.6 - php: 5.6
dist: trusty
- php: 7.0 - php: 7.0
dist: xenial
env: PHPUNIT=5.7
- php: 7.1 - php: 7.1
- php: 7.2 - php: 7.2
- php: hhvm - php: 7.3
env: HHVM=true
install: install:
- composer install - composer install
- if [[ $HHVM == true ]]; then composer require "phpunit/phpunit:5.7"; fi - if [[ $PHPUNIT == 5.7 ]]; then composer require "phpunit/phpunit:5.7"; fi
before_script: before_script:
- mkdir -p build/logs - mkdir -p build/logs
- cd tests - cd tests
script: script:
- if [[ $HHVM == true ]]; then ../vendor/bin/phpunit --colors --coverage-clover ../build/logs/clover.xml .; fi - |
- if [[ $HHVM != true ]]; then phpunit --colors --coverage-clover ../build/logs/clover.xml .; fi if [[ $PHPUNIT == 5.7 ]]; then
../vendor/bin/phpunit --colors --coverage-clover ../build/logs/clover.xml .
else
phpunit --colors --coverage-clover ../build/logs/clover.xml .
fi
after_success: after_success:
- cd .. - cd ..

View file

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014, 2015, 2016, 2017, 2018 Josh Sherman Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019 Josh Sherman
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -4,36 +4,14 @@
[![Coverage Status](https://coveralls.io/repos/github/joshtronic/php-loremipsum/badge.svg?branch=master)](https://coveralls.io/github/joshtronic/php-loremipsum?branch=master) [![Coverage Status](https://coveralls.io/repos/github/joshtronic/php-loremipsum/badge.svg?branch=master)](https://coveralls.io/github/joshtronic/php-loremipsum?branch=master)
[![Total Downloads](https://poser.pugx.org/joshtronic/php-loremipsum/downloads)](https://packagist.org/packages/joshtronic/php-loremipsum) [![Total Downloads](https://poser.pugx.org/joshtronic/php-loremipsum/downloads)](https://packagist.org/packages/joshtronic/php-loremipsum)
Lorem ipsum generator in PHP without dependencies. Compatible with PHP 5.3+ as Lorem ipsum generator in PHP without dependencies. Compatible with PHP 5.3+.
well as HHVM.
## Origins [![Become a Patron](https://joshtronic.com/images/become-patron.png)](https://www.patreon.com/joshtronic)
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
wouldnt 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 someones code the liklihood of them accepting a pull
request goes down dramatically, hence building this library while taking cues
from its predecessor.
Also, the aforementioned package had a bunch of “setter” and “getter” methods
that were grossing me out :scream:
## Installation ## Installation
The preferred installation method is via `composer`. First add the following The preferred installation method is via `composer`. First add the following to
to your `composer.json` your `composer.json`:
```json ```json
"require": { "require": {
@ -41,7 +19,7 @@ to your `composer.json`
} }
``` ```
Then run `composer update` Then run `composer update`.
## Usage ## Usage
@ -58,21 +36,21 @@ echo '1 word: ' . $lipsum->word();
echo '5 words: ' . $lipsum->words(5); echo '5 words: ' . $lipsum->words(5);
``` ```
### Generating sentences ### Generating Sentences
```php ```php
echo '1 sentence: ' . $lipsum->sentence(); echo '1 sentence: ' . $lipsum->sentence();
echo '5 sentences: ' . $lipsum->sentences(5); echo '5 sentences: ' . $lipsum->sentences(5);
``` ```
### Generating paragraphs ### Generating Paragraphs
```php ```php
echo '1 paragraph: ' . $lipsum->paragraph(); echo '1 paragraph: ' . $lipsum->paragraph();
echo '5 paragraphs: ' . $lipsum->paragraphs(5); 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 If you would like to wrap the generated text with a tag, pass it as the second
parameter: parameter:
@ -99,7 +77,7 @@ echo $lipsum->words(3, '<li><a href="$1">$1</a></li>');
// Generates: <li><a href="...">...</a></li><li><a href="...">...</a></li><li><a href="...">...</a></li> // Generates: <li><a href="...">...</a></li><li><a href="...">...</a></li><li><a href="...">...</a></li>
``` ```
### Return as an array ### Return as an Array
Perhaps you want an array instead of a string: Perhaps you want an array instead of a string:
@ -117,16 +95,25 @@ print_r($lipsum->wordsArray(5, 'li'));
## Assumptions ## Assumptions
Instead of having an option as to whether or not a string should start the The first string generated will always start with the traditional "Lorem ipsum
generated output with “Lorem ipsum dolor sit amet, consectetur adipiscing dolor sit amet, consectetur adipiscing elit". Subsequent strings may contain
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. those words but will not explicitly start with them.
## Contributing ## Contributing
Suggestions and bug reports are always welcome, but karma points are earned Suggestions and bug reports are always welcome, but karma points are earned for
for pull requests. pull requests.
Unit tests are required for all contributions. You can run the test suite Unit tests are required for all contributions. You can run the test suite from
from the `tests` directory simply by running `phpunit .` 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

View file

@ -1,7 +1,7 @@
{ {
"name": "joshtronic/php-loremipsum", "name": "joshtronic/php-loremipsum",
"description": "Lorem ipsum generator in PHP without dependencies", "description": "Lorem ipsum generator in PHP without dependencies",
"version": "1.0.3", "version": "1.0.4",
"type": "library", "type": "library",
"keywords": [ "keywords": [
"lorem", "lorem",

View file

@ -9,7 +9,7 @@
* Redistribution of these files must retain the above copyright notice. * Redistribution of these files must retain the above copyright notice.
* *
* @author Josh Sherman <hello@joshtronic.com> * @author Josh Sherman <hello@joshtronic.com>
* @copyright Copyright 2014, 2015, 2016, 2017, 2018 Josh Sherman * @copyright Copyright 2014, 2015, 2016, 2017, 2018, 2019 Josh Sherman
* @license http://www.opensource.org/licenses/mit-license.html * @license http://www.opensource.org/licenses/mit-license.html
* @link https://github.com/joshtronic/php-loremipsum * @link https://github.com/joshtronic/php-loremipsum
*/ */