gfg / dto-url
This package is abandoned and no longer maintained.
No replacement package was suggested.
There is no license information available for the latest version (1.0.1) of this package.
Library to handle and wrap URL informations
1.0.1
2016-03-28 20:36 UTC
Requires
- gfg/dto-context: 1.0.*
Requires (Dev)
- pdepend/pdepend: @stable
- phploc/phploc: @stable
- phpmd/phpmd: @stable
- phpunit/php-invoker: @stable
- phpunit/phpunit: @stable
- sebastian/phpcpd: @stable
- squizlabs/php_codesniffer: @stable
This package is not auto-updated.
Last update: 2019-02-20 19:24:13 UTC
README
INTRODUCTION
Tiny library for encapsulating an URL.
EXAMPLES OF USE
<?php use GFG\DTOUrl\Url; $urlParts = [ 'scheme' => 'http', 'host' => 'externalshop.com', 'port' => 80, 'user' => 'username', 'pass' => 'password', 'path' => ['api', 'version', 'action'], 'query' => ['query' => 'string'], 'fragment' => 'first' ]; $url = new Url($urlParts); // http://username:password@externalshop.com:80/api/version/action?query=string#first echo $url->getFullUrl();
<?php use GFG\DTOUrl\Url; $urlParts = [ 'scheme' => 'https', 'host' => 'www.externalshop.com', 'path' => ['test'] ]; $url = new Url($urlParts); // https://www.externalshop.com/test echo $url->getFullUrl();
<?php use GFG\DTOUrl\Url; $urlParts = [ 'path' => [ 'api', 'version' => 'version', 'partnerCode' => 'partner-code', 'product' ] ]; $url = new Url($urlParts); $replace = [ 'version' => 2, 'partnerCode' => 'kanui' ]; $url->replacePath($replace); // api/2/kanui/product echo $url->getFullUrl();
<?php use GFG\DTOUrl\Url; $urlParts = [ 'scheme' => 'http', 'host' => 'externalshop.com', 'port' => 80, 'user' => 'username', 'pass' => 'password', 'path' => ['api', 'version', 'action'], 'query' => ['query' => 'string'], 'fragment' => 'first' ]; $url = new Url($urlParts); $paths = [ 'version' => 'version', 'create', 'product' ]; $replace = ['version' => '2.0']; $url->setPath($paths)->replacePath($replace); // http://username:password@externalshop.com:80/2.0/create/product?query=string#first echo $this->url->getFullUrl();
<?php use GFG\DTOUrl\Url; $urlParts = [ 'scheme' => 'http', 'host' => 'externalshop.com', 'port' => 80, 'user' => 'username', 'pass' => 'password', 'path' => ['api', 'version', 'action'], 'query' => ['query' => 'string'], 'fragment' => 'first' ]; $url = new Url($urlParts); $query = ['name' => 'name']; $replace = ['name' => 'fullname']; $url->setQuery($query)->replaceQuery($replace); // http://username:password@externalshop.com:80/api/version/action?name=fullname#first echo $url->getFullUrl();