dev-master
9999999-dev https://github.com/milqmedia/mq-utilMilq Media Utilities
The Requires
- php >=5.3.3
- zendframework/zendframework 2.*
- leafo/lessphp 0.4.0
zf2 util milq media
Wallogit.com
2017 © Pedro Peláez
Milq Media Utilities
mq-utilis deprecated. Please use another package with active development., (*1)
Basic utillities used in ZF2 controller and views., (*2)
Zend Framework 2 View helpers - less() to convert LESS files to CSS - js() to retrieve versioned js files - dateFormat() to format dates in different, many used, formats - percent() to quickly calculate a percentage, (*3)
MQUtil\Collector\Milq, (*4)
ZendDeveloperTools collector listing environment, timezone and defaultlocale, (*5)
MQUtil\Log\Writer\Doctrine, (*6)
Doctrine log writer, (*7)
MQUtil\Service\ShortUrl, (*8)
Url shortner using the Google urlshortener API., (*9)
MQUtil\Service\Paginator, (*10)
Super simple and easy to use pagination class, (*11)
MQUtil\Service\Iterator, (*12)
Super simple and easy to use iteration class with prevItem support, (*13)
php composer.phar require milqmedia/mq-util:dev-master
MQUtil to the enabled modules listLess & JS helpers, (*14)
$this->headLink()->setStylesheet($this->basePath($this->less('less/site.less')))
$this->headScript()->setFile({$this->basePath($this->js('jquery')))
Percent view helper, (*15)
$this->percent($total, $count, $reverse = false);
DateFormat view helper, (*16)
$this->dateFormat($date)->dayName();
Available methods: - forumDate: Returns "H:i" if today, "d-m H:i" if this year, else "d-m-y H:i" - ago: Returns seconds, minutes, hours, days, etc. ago since given date - dayName($short = false): Dayname for the given date, if short is true dayname is in a short format e.g. Sun. - monthName: Monthname for the given date, (*17)
MQUtil\Collector\Milq, (*18)
Add the collector to the zdt config file, (*19)
array(
'zenddevelopertools' => array(
'profiler' => array(
'collectors' => array('milq' => 'MQUtil\Collector\Milq'),
),
)
And a template to the toolbar, (*20)
array(
'zenddevelopertools' => array(
'toolbar' => array(
'entries' => array(
'milq' => 'zend-developer-tools/toolbar/milq',
),
)
)
)
MQUtil\Log\Writer\Doctrine, (*21)
Copy the Log.php.dist file from the package root to your entity directory. Change the namespace if necessary., (*22)
Use it like this:, (*23)
$this->getServiceLocator()->get('Zend\Log\Logger')->err("error")
MQUtil\Service\ShortUrl, (*24)
Configure your Google API Key:, (*25)
return array(
'google_short_url' => array(
'apiKey' => '<key>',
)
);
Use it like this:, (*26)
$shortUrlApi = $this->getServiceLocator()->get('MQUtil\Service\ShortUrl');
$response = $shortUrlApi->shortenUrl('http://google.com');
If successful, the response will look like:, (*27)
{
"kind": "urlshortener#url",
"id": "http://goo.gl/fbsS",
"longUrl": "http://www.google.com/"
}
MQUtil\Service\Paginator, (*28)
Create a new pagination object:, (*29)
$paginator = $this->getServiceLocator()->get('MQUtil\Service\Paginator')->getPaginator($numberOfItems, $numberOfItemsPerPage, $currentPage);
Available methods:, (*30)
$paginator->next(); $paginator->prev(); $paginator->current(); $paginator->total(); $paginator->offsetStart(); $paginator->isLastPage();
MQUtil\Service\Iterator, (*31)
Create a new iteration object:, (*32)
$iterator = $this->getServiceLocator()->get('MQUtil\Service\Iterator')->getIterator($array, $currentItem);
Available methods:, (*33)
$iterator->hasNext(); $iterator->nextItem(); $iterator->hasPrev(); $iterator->prevItem(); $iterator->currentItem(); $iterator->isLastItem();
..., (*34)
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)Milq Media Utilities
zf2 util milq media