2017 © Pedro PelĂĄez
 

library readme-tester

Validate code examples in readme files

image

hanneskod/readme-tester

Validate code examples in readme files

  • Friday, June 8, 2018
  • by hanneskod
  • Repository
  • 2 Watchers
  • 4 Stars
  • 1,952 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 1 Forks
  • 9 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Readme-Tester

Packagist Version Build Status Quality Score, (*1)

Validate PHP code examples in documentation., (*2)

This file describes version 2 which uses php8 attributes., (*3)

For version 1 which uses docblock style annotations see this link., (*4)

Why?

Did you update your library, but forgot to update code examples in README? Are your users complaining on syntax errors in your examples? Do you find it too cumbersome to manually test all examples? Readme-Tester lets you automate the process of validating PHP code examples in documentation files., (*5)

A simple example

Readme-Tester uses php8 style attributes inside HTML-comments (to make them invisible after rendering on for example github) to specify the expected result of a code example., (*6)

The following simple example asserts that the code outputs content., (*7)

<!--
#[ReadmeTester\ExpectOutput('/foo/')]
-->
```php
echo "foobar";
```

For more information read the documentation., (*8)

Installation

Install using [phive][3], (*9)

phive install hanneskod/readme-tester

As a phar archive

Download the latest phar archive from the releases tab., (*10)

Optionally rename readme-tester.phar to readme-tester for a smoother experience., (*11)

Using composer

Install as a composer dependency, (*12)

composer require --dev hanneskod/readme-tester

This will make readme-tester avaliable as vendor/bin/readme-tester., (*13)

From source

To build you need make, (*14)

make
sudo make install

The build script uses composer to handle dependencies and [phive][3] to handle build tools. If they are not installed as composer or phive respectivly you can use something like, (*15)

make COMPOSER_CMD=./composer.phar PHIVE_CMD=./phive.phar

Getting started

Using the command line tool is as simple as, (*16)

readme-tester README.md

For more detailed information use, (*17)

readme-tester -h

The Versions

08/06 2018

dev-master

9999999-dev https://github.com/hanneskod/readme-tester

Validate code examples in readme files

  Sources   Download

WTFPL Unlicense

The Requires

 

The Development Requires

by Hannes ForsgÄrd

phpunit testing readme code examples

08/06 2018

1.0-beta.4

1.0.0.0-beta4 https://github.com/hanneskod/readme-tester

Validate code examples in readme files

  Sources   Download

Unlicense

The Requires

 

The Development Requires

by Hannes ForsgÄrd

phpunit testing readme code examples

21/02 2017

1.0-beta.3

1.0.0.0-beta3 https://github.com/hanneskod/readme-tester

Validate code examples in readme files

  Sources   Download

WTFPL

The Requires

 

The Development Requires

by Hannes ForsgÄrd

phpunit testing code examples

14/02 2017

1.0-beta.2

1.0.0.0-beta2 https://github.com/hanneskod/readme-tester

Validate code examples in readme files

  Sources   Download

WTFPL

The Requires

 

The Development Requires

by Hannes ForsgÄrd

phpunit testing code examples

07/01 2017

1.0-beta.1

1.0.0.0-beta1 https://github.com/hanneskod/readme-tester

Validate code examples in readme files

  Sources   Download

WTFPL

The Requires

 

The Development Requires

by Hannes ForsgÄrd

phpunit testing code examples