Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastiansulinski/smart-quotes
Smart quotes replacement toolkit
https://github.com/sebastiansulinski/smart-quotes
ascii php smart-quotes utf-8 utf8
Last synced: about 1 month ago
JSON representation
Smart quotes replacement toolkit
- Host: GitHub
- URL: https://github.com/sebastiansulinski/smart-quotes
- Owner: sebastiansulinski
- License: mit
- Created: 2015-02-11T09:50:08.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2024-07-09T14:46:19.000Z (6 months ago)
- Last Synced: 2024-10-14T03:50:30.487Z (2 months ago)
- Topics: ascii, php, smart-quotes, utf-8, utf8
- Language: PHP
- Size: 32.2 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Smart quotes replacement toolkit
The kit replaces all irregular - Microsoft version single and double quotes to simple - ASCII type ones.
## Requirements
Starting from version 1.3.0 package requires PHP 7.1 or higher. Please use version 1.2.0 for PHP 7.0 or 1.0.5 for earlier versions.
## Usage example
There are two implementations - one, which converts quotes and returns content as UTF-8
and the other which does the same, but returns it as ASCII - with the exception of a pound symbol (£),
which is also returned correctly.```
use SSD\SmartQuotes\Utf8CharacterSet;
use SSD\SmartQuotes\Factory as SmartQuotesFactory;$string = "“Contrary to ‘popular belief’, Lorem Ipsum is not simply ‘random text’. The cost in Sterling is £20.00”";
// UTF-8 implementation
echo SmartQuotesFactory::filter(new Utf8CharacterSet, $string);// ASCII implementation
echo SmartQuotesFactory::filter(new AsciiCharacterSet, $string);// both return:
// "Contrary to 'popular belief', Lorem Ipsum is not simply 'random text'. The cost in Sterling is £20.00"
```