Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vstelmakh/url-highlight-symfony-bundle
Symfony bundle for url highlight library
https://github.com/vstelmakh/url-highlight-symfony-bundle
highlight html symfony symfony-bundle url
Last synced: 9 days ago
JSON representation
Symfony bundle for url highlight library
- Host: GitHub
- URL: https://github.com/vstelmakh/url-highlight-symfony-bundle
- Owner: vstelmakh
- License: mit
- Created: 2019-12-22T23:08:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-04T15:47:58.000Z (almost 4 years ago)
- Last Synced: 2024-09-30T14:18:01.989Z (about 2 months ago)
- Topics: highlight, html, symfony, symfony-bundle, url
- Language: PHP
- Homepage:
- Size: 68.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Url highlight bundle
[![Build status](https://github.com/vstelmakh/url-highlight-symfony-bundle/workflows/build/badge.svg?branch=master)](https://github.com/vstelmakh/url-highlight-symfony-bundle/actions)
[![Packagist version](https://img.shields.io/packagist/v/vstelmakh/url-highlight-symfony-bundle?color=orange)](https://packagist.org/packages/vstelmakh/url-highlight-symfony-bundle)
[![PHP version](https://img.shields.io/packagist/php-v/vstelmakh/url-highlight-symfony-bundle)](https://www.php.net/)
[![License](https://img.shields.io/github/license/vstelmakh/url-highlight-symfony-bundle?color=yellowgreen)](LICENSE)Symfony bundle for [Url highlight](https://github.com/vstelmakh/url-highlight) library.
Supported Symfony versions: `^2.7`, `^3`, `^4`, `^5`.## Installation
Install the latest version with:
```bash
$ composer require vstelmakh/url-highlight-symfony-bundle
```## Setup
If your application is using [Symfony Flex](https://symfony.com/doc/current/setup/flex.html) - you are ready to go, skip next steps.Enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:```php
// config/bundles.phpreturn [
// ...
VStelmakh\UrlHighlightSymfonyBundle\UrlHighlightBundle::class => ['all' => true],
];
```## Usage
Bundle provide url highlight service which available via autowire or directly from container:
```php
container->get('vstelmakh.url_highlight');
}
}
```Additionally `urls_to_html` filter available in templates:
```twig
{{ 'Basic example http://example.com'|urls_to_html }}{# output: Basic example http://example.com #}
```More details see usage in [Twig url highlight](https://github.com/vstelmakh/url-highlight-twig-extension#usage) repository.
## Configuration
Works out of the box with default configuration:
```yaml
url_highlight:
validator: ~
highlighter: ~
encoder: ~
```
If you need to change configuration add desired options to your `parameters.yaml` or create separate config: `config/packages/url_highlight.yaml`.
More information about configuration options could be found in [Url highlight](https://github.com/vstelmakh/url-highlight#configuration) library.### Example to define validator to not match urls without scheme
- Define validator service. Use bundled with Url highlight library or create your own implementation
of `VStelmakh\UrlHighlight\Validator\ValidatorInterface`:
```yaml
# config/services.yaml
services:
...
VStelmakh\UrlHighlight\Validator\Validator:
arguments: [false]
```- Provide service id in `url_highlight.yaml` config
```yaml
# config/packages/url_highlight.yaml
url_highlight:
validator: VStelmakh\UrlHighlight\Validator\Validator
```## Credits
[Volodymyr Stelmakh](https://github.com/vstelmakh)
Licensed under the MIT License. See [LICENSE](LICENSE) for more information.