Skip to content
This repository has been archived by the owner on Aug 12, 2019. It is now read-only.

Commit

Permalink
readme: added usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Oct 15, 2014
1 parent 4055000 commit 3e6e55e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Expand Up @@ -15,3 +15,30 @@ Add to your composer.json:
"nextras/link-factory": "~1.0"
}
```


### Example

```php
use Nextras\Application\LinkFactory;

class Example
{
/** @var LinkFactory */
private $linkFactory;

public function __construct(LinkFactory $linkFactory)
{
$this->linkFactory = $linkFactory;
}

public function doSomething()
{
// relative link with optional fragment (#comments) and parameters
$link = $this->linkFactory->link('Products:view#comments', ['id' => 123]);

// absolute link starts with '//'
$link = $this->linkFactory->link('//Homepage:default');
}
}
```

0 comments on commit 3e6e55e

Please sign in to comment.