https://github.com/vjik/linkify
Matches things like email addresses, web URLs, etc. in the text and makes them clickable links.
https://github.com/vjik/linkify
Last synced: about 2 months ago
JSON representation
Matches things like email addresses, web URLs, etc. in the text and makes them clickable links.
- Host: GitHub
- URL: https://github.com/vjik/linkify
- Owner: vjik
- License: bsd-3-clause
- Created: 2021-02-16T14:40:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-15T14:31:36.000Z (over 3 years ago)
- Last Synced: 2024-08-19T21:31:33.089Z (11 months ago)
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Linkify
[](https://packagist.org/packages/vjik/linkify)
[](https://packagist.org/packages/vjik/linkify)
[](https://github.com/vjik/linkify/actions?query=workflow%3Abuild)
[](https://dashboard.stryker-mutator.io/reports/github.com/vjik/linkify/master)
[](https://github.com/vjik/linkify/actions?query=workflow%3A%22static+analysis%22)The package provide `Linkify` class that matches things like email addresses, web URLs, etc. in the text and makes them clickable links.
## Requirements
- PHP 7.4 or higher.
## Installation
The package could be installed with [composer](https://getcomposer.org/download/):
```shell
composer require vjik/linkify --prefer-dist
```## General usage
```php
$linkify = new \Vjik\Linkify\Linkify(
new \Vjik\Linkify\HttpPattern(),
new \Vjik\Linkify\EmailPattern(),
);$text = 'Contacts: https://example.com, [email protected].';
$result = $linkify->process($text);
````$result` will be:
```html
Contacts: example.com, [email protected].
```## Testing
### Unit testing
The package is tested with [PHPUnit](https://phpunit.de/). To run tests:
```shell
./vendor/bin/phpunit
```### Mutation testing
The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:```shell
./vendor/bin/roave-infection-static-analysis-plugin
```### Static analysis
The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
```shell
./vendor/bin/psalm
```## License
The Linkify is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.