erpk/common

There is no license information available for the latest version (v0.3.17) of this package.

This package's canonical repository appears to be gone and the package has been frozen as a result.

Maintainers

Details

github.com/erpk/common

v0.3.17 2018-01-18 22:00 UTC

README

It is bundle of useful eRepublik's utilities. ###Erpk\Common\DateTime That class extends original PHP DateTime. Examples: ####Create DateTime from eRepublik day

<?php
use Erpk\Common\DateTime;
$dateTime = DateTime::createFromDay(1849);
echo 'Day 1849 is '.$dateTime->format('Y-m-d');

Output

Day 1849 is 2012-12-12

####Show current eRepublik day

<?php
use Erpk\Common\DateTime;
$dateTime = new DateTime;
echo 'Today is '.$dateTime->getDay().' eRepublik\'s day';

Output (may differ)

Today is 1849 eRepublik's day

###Erpk\Common\EntityManager

<?php
use Erpk\Common\EntityManager;
$em = new EntityManager;

// Search for country
$countries = $em->getRepository('Erpk\Common\Entity\Country');

$country = $countries->findOneByCode('AU');
echo $country->getId(); // returns "50"
echo $country->getName(); // returns "Australia"
echo $country->getCode(); // returns "AU"

// You can also search by ID or name
$country = $countries->findOneById(50);
$country = $countries->findOneByName('Australia');