2017 © Pedro PelĆ”ez
 

library htmlentities

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

image

gavinggordon/htmlentities

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  • Wednesday, February 1, 2017
  • by gavinggordon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

HtmlEntities v4.1

Build Status Dependency Status Total Packagist Downloads Usage License, (*1)

Description

The ability to encode and decode a certain set of characters called 'Html Entities' has existed since PHP4. Amongst the vast number of functions built into PHP, there are 4 nearly identical functions that are used to encode and decode html entities; despite their similarities, however, 2 of them do provide additional capabilities not available to the others., (*2)

Encoding Functions Decoding Functions
htmlentities¹ html_entity_decode¹
htmlspecialchars² htmlspecialchars_decode²

¹ htmlentities and html_entity_decode can only encode and decode characters within PHP's HTML translations table., (*3)

² htmlspecialchars and htmlspecialchars_decode can only encode and decode special characters³., (*4)

³ special characters are not interpreted as HTML tags and 8-bit characters are encoded as ASCII characters only., (*5)

What Sets This Apart

What sets this class apart from the rest is that this class, in addition to being able to encode and decode all of the same characters/entities that can be encoded and decoded by PHP's htmlentities() and html_entity_decode() functions, it can also encode and decode a very large number of characters/entities which PHP's built-in htmlentities encoding and decoding functions won't encode/decode, due to their lack of special meaning in HTML, like:, (*6)

  • punctuation characters;
  • ASCII characters;
  • Greek characters;
  • Latin characters;
  • Russian characters;
  • Arithmetic characters;
  • and tons more...

Usage

Installation (via Composer)

    composer require gavinggordon/htmlentities

Examples

Instantiation:

    include_once( __DIR__ . '/vendor/autoload.php' );

    $htmlentities = new \GGG\HtmlEntities();

Encoding:

    $to_encode = 'Test-,;:';
    // Set a variable containing a string of the encoded characters you wish to be encoded;

    $encoded = $htmlentities->encode( $to_encode );
    // Get the encoded result by using the encode method on the returned instance of HtmlEntities;

    echo $encoded;
    // Display the encoded result, which is of type String;
    // Test‐,;:

Decoding:

```php $to_decode = 'Test˜*(#'; // Set a variable containing a string of the encoded characters you wish to be decoded;, (*7)

$decoded = $htmlentities->decode( $to_decode );
// Get the decoded result by using the decode method on the returned instance of HtmlEntities;

echo $decoded;
// Display the decoded result, which is of type String;
// Test~*(#

```, (*8)


More Information

CodeClimate

Check out our CodeClimate stats by clicking here., (*9)

PHP Innovation Award

This class has been awarded a PHP Innovation Award, provided by PHPClasses.org. My other PHP classes are accessible online via my GitHub profile or PHPClasses.org profile., (*10)


The Versions

01/02 2017

dev-master

9999999-dev http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Development Requires

php html formatter encoding decoding encoder encode decode decoder entities htmlentities get_html_translation_table html_translation_table translation_table html_translation v4.1

14/05 2016

4.1

4.1.0.0 http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Development Requires

php html formatter encoding decoding encoder encode decode decoder entities htmlentities get_html_translation_table html_translation_table translation_table html_translation v4.1

09/05 2016

4.0

4.0.0.0 http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Development Requires

php html formatter encoding decoding encoder encode decode decoder entities htmlentities get_html_translation_table html_translation_table translation_table html_translation v4.0

05/05 2016

3.0

3.0.0.0 http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Development Requires

php html format encode decode entities htmlentities v3.0

04/05 2016

2.0.2

2.0.2.0 http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Development Requires

php html format encode decode entities htmlentities v2.0.2

04/05 2016

2.0.1

2.0.1.0 http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Development Requires

php html format encode decode entities htmlentities v2.0.1

04/04 2016

1.0.0

1.0.0.0 http://htmlentities.gavingordon.com

A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

php html format encode decode entities 1.0.0 htmlentities