https://github.com/imliam/php-indefinite-article
Determine the indefinite article of an English term
https://github.com/imliam/php-indefinite-article
Last synced: 5 months ago
JSON representation
Determine the indefinite article of an English term
- Host: GitHub
- URL: https://github.com/imliam/php-indefinite-article
- Owner: imliam
- License: mit
- Created: 2019-02-12T22:28:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-09T19:25:02.000Z (over 1 year ago)
- Last Synced: 2025-10-02T08:18:12.848Z (9 months ago)
- Language: PHP
- Size: 122 KB
- Stars: 2
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PHP Indefinite Articles
[](https://packagist.org/packages/imliam/php-indefinite-article)

[](https://packagist.org/packages/imliam/php-indefinite-article)
[](LICENSE.md)
Determine the indefinite article of an English term.
An indefinite article is the word that comes before nouns or noun equivalents in English, such as "_a_" or "_an_". If the word starts with a consonant sound, the article used should be "_a_" — for example "banana" becomes "_a_ banana". If the word starts with a vowel sound, the article used should be "_an_" — for example "apple" becomes "_an_ apple".
This is not as simple as checking whether the first character of the word is a vowel or consonant as that does not determine the sound pronounced when speaking the word.
This is a port of [Eamon Nerbonne's original solution](https://github.com/EamonNerbonne/a-vs-an) for the problem.
- [PHP Indefinite Articles](#php-indefinite-articles)
- [💾 Installation](#💾-installation)
- [📝 Usage](#📝-usage)
- [✅ Testing](#✅-testing)
- [🔖 Changelog](#🔖-changelog)
- [⬆️ Upgrading](#⬆️-upgrading)
- [🎉 Contributing](#🎉-contributing)
- [🔒 Security](#🔒-security)
- [👷 Credits](#👷-credits)
- [♻️ License](#♻️-license)
## 💾 Installation
You can install the package with [Composer](https://getcomposer.org/) using the following command:
```bash
composer require imliam/php-indefinite-article:^1.0.0
```
## 📝 Usage
``` php
$word = new ImLiam\IndefiniteArticle\IndefiniteArticle('apple');
echo $word->parse();
// "an apple"
echo $word->article();
// "an"
```
## ✅ Testing
``` bash
composer test
```
## 🔖 Changelog
Please see [the changelog file](CHANGELOG.md) for more information on what has changed recently.
## ⬆️ Upgrading
Please see the [upgrading file](UPGRADING.md) for details on upgrading from previous versions.
## 🎉 Contributing
Please see the [contributing file](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) for details on contributing to the project.
### 🔒 Security
If you discover any security related issues, please email liam@liamhammett.com instead of using the issue tracker.
## 👷 Credits
- [Liam Hammett](https://github.com/imliam)
- [Eamon Nerbonne](https://github.com/EamonNerbonne/a-vs-an) for the original solution
- [All Contributors](../../contributors)
## ♻️ License
The MIT License (MIT). Please see the [license file](LICENSE.md) for more information.