It's the shortest url view helper ever for Zend Framework 2! :-)
For routing:
user/profile/:id/:slug
Implements interface:
class User implements \ZfSnapUrl\Routable {
public function getRouteName() {
return 'user/profile';
}
public function getRouteParams() {
return array(
'id' => $this->getId(),
'slug' => $this->getSlug(),
);
}
}And just write in view to print user profile url:
<?= $this->u($this->user) ?>Without ZfSnapUrl you need to write THIS every single time (!):
<?= $this->url('user/profile', array('id' => $this->user->getId(), 'slug' => $this->user->getSlug())) ?>Via composer
{
"require": {
"snapshotpl/zf-snap-url": "dev-master"
}
}composer install --dev
or
composer update
then
bin/phpunit src/