roksta/punctuator
Composer 安装命令:
composer require roksta/punctuator
包简介
very simple punctuation for texts.
README 文档
README
A simple punctuator for texts. Adds spaces after punctuation marks and formats texts.
How It Works
It is just a simple script that accespts a string and inspects it so that: The text begins with an uppercase character. After every fullstop(.) or question mark(?), there is a space and the next work begins with an uppercase character. After every comma(,), there is a space.
It is especially useful for formating user input before saving them to the database. It takes advantage of Laravel's model listeners through a Spacer.php trait.
Usage
use Roksta\Punctuator\Spacer; class MyModel extends Model { use Spacer; /** * set the columns you wish to punctuate in an array in the form shown below; * short defines columns where each word is to begin with an uppercase letter, eg, names, locations, etc * long is for sentences where spaces will be added after every comma, fullstop, etc. */ public function setPunctuateColumns(): Array { return ['short' => ['name'], 'long' => ['description', 'comments']]; } // Other model functions }
Results
sam roksta = Sam Roksta
this is very simple.really,really simple = This is very simple. Really, really simple.
统计信息
- 总下载量: 111
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-04