webino / webino-name-day-lib
Name day Library
Installs: 2 620
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.3
This package is auto-updated.
Last update: 2024-12-04 23:48:15 UTC
README
Provides API to resolve name day. Still under development. (currently only Slovak)
Features
- Today and tomorrow name day according to the date
- Reverse resolving, name day date for a name
- Holy day flag
Setup
Following steps are necessary to get this library working:
-
Add
"minimum-stability": "dev"
to your composer.json, because this lib is under development -
Run
php composer.phar require webino/webino-name-day-lib:dev-develop
Requirements
- PHP 5.3
QuickStart
// Create the name day service
$locale = 'sk_SK';
$factory = new \WebinoNameDayLib\Factory;
$nameDay = $factory->create($locale);
// Get the name day
$result = $nameDay->today();
// Holy day logic (optional)
if ($result->isHolyDay()) {
$text = 'Today is';
} else {
$text = 'Name-day today celebrating';
}
// Name day of the day
$result->getName();
// Get tomorrow name day
$result = $nameDay->tomorrow();
// Get today & tomorrow name day
$arrayOfResults = $nameDay->combo();
Functions
The service
NameDayResult today($date = 'now')
NameDayResult tomorrow($date = 'now')
array[NameDayResult, NameDayResult] combo($date = 'now')
DateTime nameDate($name)
DateTime nearestNameDate($name)
The result
string getName()
bool isHolyDay()
Develop
Requirements
- Linux (recommended)
- NetBeans (optional)
- Phing
- PHPUnit
Setup
-
Clone this repository and run:
phing update
Now your development environment is set.
-
Open project in the (NetBeans) IDE
Adding region names
- Look at the
\WebinoNameDayLib\Region\Sk
- It's best to extend
\WebinoNameDayLib\Region\AbstractNames
Testing
-
Run
phpunit
in the test directory -
Run
phing test
in the module directory to run the tests and code insightsNOTE: To run the code insights there are some tool requirements.
Todo
- Add Czech names
- Add other nation names
- Tests for nameDate() & nearesetNameDate()
Addendum
Please, if you are interested in this library report any issues and don't hesitate to contribute.