PHPackages                             awps/font-awesome-php - 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. awps/font-awesome-php

ActiveLibrary

awps/font-awesome-php
=====================

A PHP library for Font Awesome.

4.7.0(8y ago)4830.7k↓34.2%25[1 issues](https://github.com/awps/font-awesome-php/issues)1GPL-3.0+PHPPHP &gt;=5.3.0

Since Dec 19Pushed 8y ago7 watchersCompare

[ Source](https://github.com/awps/font-awesome-php)[ Packagist](https://packagist.org/packages/awps/font-awesome-php)[ RSS](/packages/awps-font-awesome-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)DependenciesVersions (2)Used By (1)

A PHP library for Font Awesome.
===============================

[](#a-php-library-for-font-awesome)

This repository contains the necessary data to work with Font Awesome in PHP.

**Requirements:**

- Font Awesome 4.7.0
- PHP 5.3+.

**License**

- MIT - [Details](https://github.com/awps/font-awesome-php/blob/master/LICENSE)

### Installation

[](#installation)

#### With composer:

[](#with-composer)

```
composer require awps/font-awesome-php
```

#### Manually:

[](#manually)

```
require_once 'src/load.php';
```

### Usage

[](#usage)

The library contains 2 main classes that are created for public:

- `Awps\FontAwesome()` - Uses a static array of FA icons.(Recommended)
- `Awps\FontAwesomeReader( $css_path )` - Generates the array from `font-awesome.css` file. You must define the path to this file.

Create an instance:

```
// Using the reader to dynamically get the icons array. It's resource intensive and you must cache the result.
$css_path = __DIR__ . '/css/font-awesome.css';
$icons    = new Awps\FontAwesomeReader( $css_path );

// .... or better use the static class

$icons = new Awps\FontAwesome();
```

Next it's easy. You can get the array of icons just by doing this.

```
$icons->getArray();

// Result:
/*
array (
  'fa-glass' => '\\f000',
  'fa-music' => '\\f001',
  'fa-search' => '\\f002',
  ...
*/
```

### API:

[](#api)

#### `->getAllData()`

[](#-getalldata)

```
$icons->getAllData();

// Result:
/*
array (
  'fa-glass' =>
  array (
    'unicode' => '\\f000',
    'name' => 'Glass',
    'class' => 'fa-glass',
  ),
  'fa-music' =>
  array (
    'unicode' => '\\f001',
    'name' => 'Music',
    'class' => 'fa-music',
  ),
  ...
*/
```

#### `->getCssClasses()`

[](#-getcssclasses)

```
$icons->getCssClasses();

// Result:
/*
array (
  'fa-glass' => 'fa-glass',
  'fa-music' => 'fa-music',
  'fa-search' => 'fa-search',
  ...
*/
```

#### `->getUnicodeKeys()`

[](#-getunicodekeys)

```
$icons->getUnicodeKeys();

// Result:
/*
array (
  'fa-glass' => '\\f000',
  'fa-music' => '\\f001',
  'fa-search' => '\\f002',
  'fa-envelope-o' => '\\f003',
  ...
*/
```

#### `->getReadableNames()`

[](#-getreadablenames)

```
$icons->getReadableNames();

// Result:
/*
array (
  'fa-glass' => 'Glass',
  'fa-music' => 'Music',
  'fa-search' => 'Search',
  ...
*/
```

#### `->sortByName()`

[](#-sortbyname)

Attention: This modifies the original array. You can reset it back using `->reset()` method.

```
$icons->sortByName();

// Result:
/*
array (
  'fa-500px' => '\\f26e',
  'fa-address-book' => '\\f2b9',
  'fa-address-book-o' => '\\f2ba',
  'fa-address-card' => '\\f2bb',
  'fa-address-card-o' => '\\f2bc',
  'fa-adjust' => '\\f042',
  ...
*/
```

#### Utilities:

[](#utilities)

#### `->total()`

[](#-total)

Return the total number of icons from original array.

#### `->getIconUnicode( $icon_class )`

[](#-geticonunicode-icon_class-)

Get the unicode by icon class.

Example:

```
$icons->getIconUnicode( 'fa-address-card' );

// Result
// '\f2bb'
```

#### `->getIconName( $icon_class )`

[](#-geticonname-icon_class-)

Get the readable icon name by class.

Example:

```
$icons->getIconName( 'fa-address-card' );

// Result
// 'Address card'
```

#### `->getIcon( $icon_class )`

[](#-geticon-icon_class-)

Get the details of a single icon by class.

Example:

```
$icons->getIcon( 'fa-address-card' );

// Result
/*
array (
  'unicode' => '\\f2bb',
  'name' => 'Address card',
  'class' => 'fa-address-card',
)
*/
```

#### `->getIconByUnicode( $unicode )`

[](#-geticonbyunicode-unicode-)

Get the details of a single icon by unicode.

Example:

```
$icons->getIconByUnicode( '\\f004' )

// Result
/*
array (
  'unicode' => '\\f004',
  'name' => 'Heart',
  'class' => 'fa-heart',
)
*/
```

#### `->reset()`

[](#-reset)

Reset the current array to its original state

Example:

```
$icons->sortByName();

// Array is sorted:
$icons->getArray();

/*
array (
  'fa-500px' => '\\f26e',
  'fa-address-book' => '\\f2b9',
  'fa-address-book-o' => '\\f2ba',
  'fa-address-card' => '\\f2bb',
  ...
);
*/

// Reset it
$icons->reset();

// This one will return the original array
$icons->getArray();

// Result:
/*
array (
  'fa-glass' => '\\f000',
  'fa-music' => '\\f001',
  'fa-search' => '\\f002',
  ...
);
*/
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.7% 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

Unknown

Total

1

Last Release

3072d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1436534?v=4)[Andrei Surdu](/maintainers/awps)[@awps](https://github.com/awps)

---

Top Contributors

[![awps](https://avatars.githubusercontent.com/u/1436534?v=4)](https://github.com/awps "awps (42 commits)")[![valeriu](https://avatars.githubusercontent.com/u/379622?v=4)](https://github.com/valeriu "valeriu (1 commits)")

---

Tags

composercomposer-packagecssfontfont-awesomefontawesomefontawesome-iconsiconsphpunicode

### Embed Badge

![Health badge](/badges/awps-font-awesome-php/health.svg)

```
[![Health](https://phpackages.com/badges/awps-font-awesome-php/health.svg)](https://phpackages.com/packages/awps-font-awesome-php)
```

PHPackages © 2026

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