Installation
Requirements
- PHP 8.1 or higher
- Composer
Install via Composer
Install the package using Composer:
composer require byjg/convert
Verify Installation
After installation, you can verify the package is installed correctly:
<?php
require 'vendor/autoload.php';
use ByJG\Convert\ToUTF8;
use ByJG\Convert\FromUTF8;
// Test conversion
echo ToUTF8::fromHtmlEntities('á'); // Should output: á
echo FromUTF8::removeAccent('João'); // Should output: Joao
Autoloading
The package uses PSR-4 autoloading. Once installed via Composer, all classes are automatically available:
<?php
require 'vendor/autoload.php';
// Classes are ready to use
$result = \ByJG\Convert\ToUTF8::fromHtmlEntities($text);
Manual Installation (Not Recommended)
If you cannot use Composer, you can manually download the source files from the GitHub repository and include them in your project. However, this approach requires you to manually handle autoloading.