PHPackages                             bca/fontawesomeiterator - 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. bca/fontawesomeiterator

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

bca/fontawesomeiterator
=======================

Iterate through the icons in FontAwesome or get them as an array.

1.0.0(12y ago)13102.4k3MITPHP &gt;=5.3.0

Since Dec 30Pushed 12y ago1 watchersCompare

[ Source](https://github.com/brodkinca/BCA-PHP-FontAwesomeIterator)[ Packagist](https://packagist.org/packages/bca/fontawesomeiterator)[ Docs](https://github.com/brodkinca/BCA-PHP-CURL)[ RSS](/packages/bca-fontawesomeiterator/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

FontAwesome Iterator
====================

[](#fontawesome-iterator)

Iterate through the icons in FontAwesome or get them as an array.

[![Build Status](https://camo.githubusercontent.com/8eb0b8b02aa32d52ffe6013b7a3e3ddfb9754583165293b2c9421bc3924e3a6a/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f62726f646b696e63612f4243412d5048502d466f6e74417765736f6d654974657261746f722e706e67)](http://travis-ci.org/brodkinca/BCA-PHP-FontAwesomeIterator)

Wait. So what is this?
----------------------

[](#wait-so-what-is-this)

Simply put, this class was created to let you iterate over FontAwesome's icons for the purpose of building user interfaces in which one must be able to choose their own icons. That said, if you have another creative use for this, go for it!

This class extends PHP's built-in [ArrayIterator](http://php.net/ArrayIterator)class, returning an `Icon` class for each icon in your local copy of FontAwesome.

Requirements
------------

[](#requirements)

1. PHP 5.2+
2. FontAwesome (Defaults created for 4.0+, but can be configured for any version.)

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

Just add the following to the require section your composer.json file:

```
"bca/fontawesomeiterator": "1.*"

```

Then execute `composer install` to pull down the latest release.

Package details can be found at .

### Via Github

[](#via-github)

You may download a specific version from  or visit the main repository at  to download unreleased code or pull down a copy via git.

Basic Usage
-----------

[](#basic-usage)

### 1. Create an Instance of the Iterator

[](#1-create-an-instance-of-the-iterator)

```
use BCA\FontAwesomeIterator\Iterator as FontAwesomeIterator;

$icons = new FontAwesomeIterator('path/to/fontawesome.css');
```

### 2. Do Something Useful

[](#2-do-something-useful)

#### foreach loop

[](#foreach-loop)

```
foreach ($icons as $icon) {
    echo $icon->class; // Do Something Here
}
```

#### while loop

[](#while-loop)

```
while ($icons->valid()) {
    $icon = $icons->current();
    echo $icon->class; // Do Something Here
    $icons->next();
}
```

Advanced Usage
--------------

[](#advanced-usage)

If you are using an older version of FontAwesome that still uses the `icon-` css prefix or a custom build of FontAweosme with a non-standard prefix it is necessary to define the prefix when instantiating the class.

### Old Skool `icon` Prefix

[](#old-skool-icon-prefix)

**Reqired for FontAwesome v3 and under.**

```
$icons = new FontAwesomeIterator('path/to/fontawesome.css', 'icon');
```

### Custom Prefix

[](#custom-prefix)

```
$icons = new FontAwesomeIterator('path/to/fontawesome.css', 'my-custom-prefix');
```

**NOTE:** The prefix should be defined without any additional hyphenation. (i.e. `prefix`) NOT `prefix-`.

Example Implementation
----------------------

[](#example-implementation)

### Create a Select List of Icons by Name

[](#create-a-select-list-of-icons-by-name)

```

```

With the correct CSS it would also be possible to display the FontAwesome icon in the select list.

Icon Class
----------

[](#icon-class)

Each value returned by `Iterator` will be an instance of the `Icon` class.

Each `Icon` will have the current properties available:

- `class` CSS class of icon
- `name` Formatted name of icon (i.e. Angle (Right) )
- `unicode` Unicode representation of icon

Properties may be accessed by calling them directly upon the Icon class (i.e. `$icon->name`).

Versioning
----------

[](#versioning)

This library will be maintained under the Semantic Versioning guidelines.

Releases will be numbered with the following format:

```
..

```

And constructed with the following guidelines:

- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bump the patch

Composer users who would like more granular control over upgrades should restrict their installation to patch updates only using this require key:

```
"bca/fontawesomeiterator": "1.0.*"

```

For more information on SemVer, please visit .

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

4523d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4feb5a2e8a07f71eb19ee7fa194924d7cad91c2bee8a93aed1ce9323881eda0?d=identicon)[brodkinca](/maintainers/brodkinca)

---

Top Contributors

[![brodkin](https://avatars.githubusercontent.com/u/236564?v=4)](https://github.com/brodkin "brodkin (6 commits)")

---

Tags

iteratorFontAwesome

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bca-fontawesomeiterator/health.svg)

```
[![Health](https://phpackages.com/badges/bca-fontawesomeiterator/health.svg)](https://phpackages.com/packages/bca-fontawesomeiterator)
```

###  Alternatives

[nikic/iter

Iteration primitives using generators

1.1k5.9M38](/packages/nikic-iter)[loophp/collection

A (memory) friendly, easy, lazy and modular collection class.

745663.8k13](/packages/loophp-collection)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4561.2M5](/packages/athari-yalinqo)[ihor/nspl

Non-standard PHP library (NSPL) - functional primitives toolbox and more

381368.5k](/packages/ihor-nspl)[ginq/ginq

LINQ to Object inspired DSL for PHP

192257.5k3](/packages/ginq-ginq)[chdemko/sorted-collections

Sorted Collections for PHP &gt;= 8.2

222.5M3](/packages/chdemko-sorted-collections)

PHPackages © 2026

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