Skip to content

grzr/ZfSnapUrl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZfSnapUrl 0.1.0

It's the shortest url view helper ever for Zend Framework 2! :-)

Usage

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())) ?>

How to install?

Via composer

{
    "require": {
        "snapshotpl/zf-snap-url": "dev-master"
    }
}

Tests

composer install --dev

or

composer update

then

bin/phpunit src/

About

It's the shortest url view helper ever for Zend Framework 2

Resources

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%