writecrow/lorem_gutenberg 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

writecrow/lorem_gutenberg

Composer 安装命令:

composer require writecrow/lorem_gutenberg

包简介

A PHP library for generating filler text from Project Gutenberg books

README 文档

README

Circle CI

A PHP library for generating random text, sourced from various authors in Project Gutenberg.

Screenshot of Text Generation

Usage in an application

The included /index.php file contains a generation form demo.

Make your code aware of the LoremGutenberg class via your favorite method (e.g., use or require)

Then pass a string of text into the class:

$text = LoremGutenberg::generate();
echo $text;
// Will return an excerpt of random length (1-10 sentences) from a random author.

$text = LoremGutenberg::generate(array('author' => 'austen'));
echo $text;
// Will return an excerpt of random length (1-10 sentences) from Jane Austen.

$text = LoremGutenberg::generate(array('author' => 'hardy', 'sentences' => 3));
echo $text;
// Will return an excerpt of 3 sentences from Thomas Hardy.

Usage as an API

The file in /api demonstrates how GET parameters in a URL can be passed to LoremGutenberg. For example, https://my-api.org/api/?author=hardy&sentences=2 will return 2 sentences' worth of LoremGutenberg from Thomas Hardy.

Parameters

Name Description Example
author If absent, a random author will be used hardy
sentences If absent, a number from 1-10 will be used 2

Sameple valid API queries

  • /api/?author=hardy&sentences=2
  • /api/?author=hardy
  • /api/?sentences=2
  • /api/

What authors are available?

As of this writing, LoremGutenberg references texts from the following authors:

public static $authors = [
  'austen' => 'Jane Austen',
  'hardy' => 'Thomas Hardy',
  'lawrence' => 'D.H. Lawrence',
  'wharton' => 'Edith Wharton',
];

Testing

Unit Tests can be run (after composer install) by executing vendor/bin/phpunit

统计信息

  • 总下载量: 94
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固