oblak / vocative
Transforms Serbian names from nominative case to vocative case
Fund package maintenance!
seebeen
Requires
- php: >= 8.0
- ext-mbstring: *
- oblak/transliterator: ^3.0
- symfony/polyfill-php84: ^1.31
Requires (Dev)
- oblak/wordpress-coding-standard: ^1.1
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2025-05-26 05:31:33 UTC
README
Vocative 🗣️
Vocative inflector for Serbian names
This library allows you to effortlessly convert Serbian personal names to their correct vocative form.
Key Features
- Peer-reviewed - The library has been tested with almost all Serbian names, and reviewed by a team of linguists.
- Easy to use - The library is designed to be simple and intuitive, making it easy for developers of all skill levels to integrate into their projects.
- Lightweight - The library is small and efficient, ensuring that it won't slow down your application.
Installation
You can install the library via Composer:
composer require oblak/vocative
Usage
Below is a simple example of how to use the library:
Basic Usage
<?php use Oblak\Vocative\Vocative; $firstName = 'Avram'; $vocative = new Vocative(); echo $vocative->make($firstName); // Outputs: Avrame
With custom dictionary
Vocative
class depends on an exception dictionary to handle special cases. By default it uses the built-in BaseDictionary
class, but you can use your own by implementing the Dictionary
interface.
Tip
We provide a NullDictionary
class that does not use any exceptions. This is useful for testing purposes.
<?php use Oblak\Vocative\Vocative; use Oblak\Vocative\NullDictionary; $firstName = 'Aleksandar'; $vocative = new Vocative(); echo $vocative->make($firstName); // Outputs: Aleksandre echo $vocative->withDictionary(new NullDictionary())->make($firstName); // Outputs: Aleksandare
Special thanks
As someone without deep expertise in Serbian linguistics, I am deeply grateful to the following individuals—without their guidance and support, this project could never have been completed:
- Svetlana Slijepčević Bjelivuk, PhD - For providing invaluable insights into intricacies of declination and conjugation of Serbian nouns and names and reviewing the data set.
- Nemanja Avramović - For his initial implementation of the
Vokativ
Library - Milana Bašić - For taking the time to gather and provide a list of Serbian names, both male and female.