PHPackages                             taylornetwork/make-html - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. taylornetwork/make-html

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

taylornetwork/make-html
=======================

A trait for to convert plain text to html, inlcuding links.

1.6.1(7y ago)055PHPPHP &gt;=7.0.0

Since Nov 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/taylornetwork/make-html)[ Packagist](https://packagist.org/packages/taylornetwork/make-html)[ RSS](/packages/taylornetwork-make-html/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (4)Versions (11)Used By (0)

MakeHTML
========

[](#makehtml)

This is a class and trait for Laravel that will convert text with line breaks and links into HTML. It also adds simple HTML tag generation as well as a helper function for imploding associative arrays.

Install
-------

[](#install)

Via Composer

```
$ composer require taylornetwork/make-html
```

### Dependencies

[](#dependencies)

`TaylorNetwork\MakeHTML` will install [TaylorNetwork\\LaravelHelpers](https://github.com/taylornetwork/laravel-helpers). Laravel should auto discover that package, but if you run into problems you may need to include the provider manually.

Setup
-----

[](#setup)

This package is set up with auto discovery so you should be good to go out of the box. Check Manual Setup below if something isn't working.

### Manual Setup

[](#manual-setup)

If auto discovery doesn't work...

Add the service provider to the providers array in `config/app.php`.

```
'providers' => [
    TaylorNetwork\MakeHTML\MakeHTMLServiceProvider::class,
];
```

Publishing
----------

[](#publishing)

Run

```
php artisan vendor:publish
```

This will add `makehtml.php` to your config directory.

Usage
-----

[](#usage)

You can use this package either by including the trait in a class you want to implement the functionality or by creating a new instance of the class.

### Trait

[](#trait)

Import the trait into your class.

```
use TaylorNetwork\MakeHTML\MakeHTML;

class DummyClass
{
    use MakeHTML;

    // Code
}
```

The MakeHTML trait includes two functions, usage examples below.

#### makeHTML (string $text)

[](#makehtml-string-text)

Accepts one parameter, the text you want the generator to parse.

Given this example variable `$text`

```
$text = 'Example text
with line
breaks. And a
link: http://example.com/page/1/2?q=This&that=other';
```

Calling makeHTML

```
$this->makeHTML($text);
```

Returns

```
'Example textwith linebreaks. And alink: example.com'
```

#### getHTMLGeneratorInstance ()

[](#gethtmlgeneratorinstance-)

Accepts no parameters and returns an instance of HTMLGenerator class, or creates one.

```
$this->getHTMLGeneratorInstance();
```

You can chain any methods from the HTMLGenerator class onto that to return functionality.

See class usage below for examples.

### Class

[](#class)

Instantiate the class.

```
use TaylorNetwork\MakeHTML\HTMLGenerator;

$instance = new HTMLGenerator();
```

#### Available Methods

[](#available-methods)

##### makeLinks (string $text)

[](#makelinks-string-text)

Converts any found links in the string to clickable links with `` tag.

Will take the base URL as the caption for the link.

For example:

```
$textWithLink = 'I have a link http://example.com/page/1/2/3?query=string';
```

Call `makeLinks($textWithLink)`

```
$instance->makeLinks($textWithLink);
```

Returns

```
'I have a link example.com'
```

##### convertLineEndings (string $text)

[](#convertlineendings-string-text)

Converts all line endings to HTML `` tags.

```
$textWithLineBreaks = 'This
is
text
with
line
breaks.';
```

Call `convertLineEndings($textWithLineBreaks)`

```
$instance->convertLineEndings($textWithLineBreaks);
```

Returns

```
'Thisistextwithlinebreaks.'
```

##### makeHTML (string $text)

[](#makehtml-string-text-1)

Calls `convertLineEndings($text)` and `makeLinks($text)` and returns the converted text.

##### generateTag (string $tag, array $attributes, boolean $closeTag = true)

[](#generatetag-string-tag-array-attributes-boolean-closetag--true)

Will generate an HTML tag with any attributes given.

To generate a `` tag with no attributes

```
$instance->generateTag('div', []);
```

Returns

```
''
```

---

To generate a `` tag with attributes

```
$attributes = [ 'class' => 'example-class second-class third' 'data-attr' => 'value' ];
```

Call function

```
$instance->generateTag('div', $attributes);
```

Returns

```
''
```

---

To generate a `` tag with attributes and also data between the tags, add the `external` attribute and everything there will be added between the tags.

```
$attributes = [
    'class' => 'example-class',
    'id' => 'div1',
    'name' => 'some-name',
    'external' => 'This is external data!',
];
```

Call function

```
$instance->generateTag('div', $attributes);
```

Returns

```
'This is external data!'
```

---

To generate a `` tag and keep it open, to process more external data for example.

```
$instance->generateTag('div', $attributes, false);
```

Returns

```
'This is external data!'
```

#### closeTag(string $tag)

[](#closetagstring-tag)

Closes a given tag

```
$instance->closeTag('div');
```

Returns

```
''
```

#### Magic Method

[](#magic-method)

You can also call `generateTag($tag, $attributes)` by calling the tag you want followed by `Tag`

To generate a `` tag this way

```
$instance->divTag($attributes);
```

Would call `generateTag('div', $attributes)` for you.

Config
------

[](#config)

The config file once published is in `config/makehtml.php`

Credits
-------

[](#credits)

- Main Author: [Sam Taylor](https://github.com/taylornetwork)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Recently: every ~152 days

Total

10

Last Release

2807d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

1.4.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/83340094473f0bf5b2cf062bf394df221a52a30aa0e21cd0a77302977d6393ce?d=identicon)[samueljtaylor](/maintainers/samueljtaylor)

---

Top Contributors

[![samyrataylor](https://avatars.githubusercontent.com/u/15961687?v=4)](https://github.com/samyrataylor "samyrataylor (37 commits)")

### Embed Badge

![Health badge](/badges/taylornetwork-make-html/health.svg)

```
[![Health](https://phpackages.com/badges/taylornetwork-make-html/health.svg)](https://phpackages.com/packages/taylornetwork-make-html)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[illuminate/pipeline

The Illuminate Pipeline package.

9348.3M267](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10533.5M991](/packages/illuminate-pagination)[illuminate/redis

The Illuminate Redis package.

8314.4M363](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

224.5M132](/packages/illuminate-cookie)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
