Table Of Contents

Previous topic

< Class Phalcon\Mvc\Router\Route

Next topic

Class Phalcon\Mvc\Url\Exception >

This Page

Class Phalcon\Mvc\Url

implements Phalcon\Mvc\UrlInterface, Phalcon\DI\InjectionAwareInterface

This components aids in the generation of: URIs, URLs and Paths

<?php

 //Generate a url appending a uri to the base Uri
 echo $url->get('products/edit/1');

 //Generate a url for a predefined route
 echo $url->get(array('for' => 'blog-post', 'title' => 'some-cool-stuff', 'year' => '2012'));

Methods

public setDI (Phalcon\DiInterface $dependencyInjector)

Sets the DependencyInjector container

public Phalcon\DiInterface getDI ()

Returns the DependencyInjector container

public setBaseUri (string $baseUri)

Sets a prefix to all the urls generated

<?php

$url->setBaseUri('/invo/');

public string getBaseUri ()

Returns the prefix for all the generated urls. By default /

public setBasePath (string $basePath)

Sets a base paths for all the generated paths

<?php

$url->setBasePath('/var/www/');

public string getBasePath ()

Returns a base path

public string get ([string|array $uri])

Generates a URL

public string path ([string $path])

Generates a local path