https://github.com/james2doyle/parsetweet
This function can parse tweets and wrap @ mentions, #hashtags, and URLs in link tags.
https://github.com/james2doyle/parsetweet
Last synced: about 1 year ago
JSON representation
This function can parse tweets and wrap @ mentions, #hashtags, and URLs in link tags.
- Host: GitHub
- URL: https://github.com/james2doyle/parsetweet
- Owner: james2doyle
- License: mit
- Created: 2016-05-13T19:22:14.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-13T19:27:14.000Z (about 10 years ago)
- Last Synced: 2025-04-02T22:33:07.357Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
parse_tweet
===========
This package adds a single function called `parse_tweet` to your project. It does one thing. Parses tweets.
This function can parse @mentions, #hashtags, and URLs. All links are given `target="_blank"` and a title when appropriate.
## Installation
Put a file named composer.json at the root of your project, containing your project dependencies:
```json
{
"require": {
"james2doyle/parsetweet": ">=1.0"
}
}
```
Or use `composer require james2doyle/parsetweet`
## Examples
Here are some example outputs:
```
"This is a simple link https://google.com" == "This is a simple link https://google.com"
"This is a simple mention for @james2doyle" == "This is a simple mention for @james2doyle"
"This is a simple #hashtag" == "This is a simple #hashtag"
"This #weather is crazy! @weatherchannel" == "This #weather is crazy! @weatherchannel"
"@james2doyle you need to visit https://warpaintmedia.ca because it is #cool!" == "@james2doyle you need to visit https://warpaintmedia.ca because it is #cool!"
```
## Running tests
Go to the project root and run `phpunit`.
## License
**The MIT License**
Copyright (c) 2014 [James Doyle](http://twitter.com/james2doyle) james2doyle@gmail.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.