Download the PHP package nsaliu/laravel-uri without Composer
On this page you can find all versions of the php package nsaliu/laravel-uri. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nsaliu/laravel-uri
More information about nsaliu/laravel-uri
Files in nsaliu/laravel-uri
Package laravel-uri
Short Description A URI component for Laravel framework
License MIT
Homepage https://github.com/nsaliu/laravel-uri
Informations about the package laravel-uri
Laravel URI package
A simple and useful URI package for Laravel framework.
This package provides an object representation of a uniform resource identifier (URI), an easy access and manipulation to the parts of the URI.
Installation
This package requires PHP 7.2 and Laravel 5.8 or higher.
Install with composer:
Methods
createFromString
Creates a new instance with the specified URI.
toString
Return the string representation of the URI instance.
hostIsReachable
Check with a GET call if the host returns an HTTP status code equals to 200.
equals
Check if a string representation of the URI equals to the URI instance.
getComponents
Gets all the URIs components if presents.
Return:
Getters
getScheme
Get the scheme part of the URI.
If a scheme is present return otherwise an .
getUsername
Get the user part of the URI.
If a user is present returns , otherwise return an .
getPassword
Get the pass part of the URI.
If a password is set return , otherwise return an .
getAuthority
Get the authority part of the URI.
Return:
- if no authority information is present, this method return an .
- if authority is set return it in form of: .
- if the port is a standard port for scheme, the port is not included, otherwise yes.
Example:
Return
getAuthorityWithPort
Get the authority part of the URI with the port too, even if it's the default for the scheme.
Return
getUserInfo
Get the user part of the URI.
Return:
- if no user information is present return an .
- if a user is present in the URI return .
- if a password is present it returns the password too separated by ':' from the username
getHost
Get the host part of the URI.
Return
getPort
Get the port part of the URI.
Return:
- if the port is present return the port as an integer: .
- if the port is not present, return .
isDefaultPort
Get whether the port value of the URI is the default for the scheme.
Return:
- if the port is default for the scheme.
- if the port isn't the default.
getPath
Get the path value of the URI.
Return:
- if a path is present return .
- if the path is not present return an .
getPathAsArray
Get the path value of the URI as an array.
Return:
-
if the path is present return the path portion of the URI as an array:
- if path is not present return an .
getQuery
Get the query part of the URI.
Return:
- if the query part of the URI is present return .
- if the query part of the URI is not present return an .
getQueryValue
Get the value of a given query key.
Return:
- if the key exists in query return: .
- if the key not exists in query part return an .
getQueryAsArray
Get the query part of the URI as an array.
Return:
-
if the query part is present return:
- if the query part not exists return an .
getPathAndQuery
Get the path and query part of the URI.
Return:
- if the path and query exists return .
- if the path exists and query not exists return .
- if the path not exists and query too return an .
getFragment
Get the fragment part of the URI.
Return:
- if the fragment is present return .
- if the fragment is not present return an .
Setters
setScheme
Set the scheme part of the URI.
setUsername
Set the user part of the URI.
setPassword
Set the password part of the URI.
setUserInfo
Set the user and password part of the URI.
setHost
Set the host part of the URI.
setPort
Set the port part of the URI.
setPath
Set the path part of the URI.
setQuery
Set the query part of the URI.
setQueryArray
Set the query part of the URI with an array.
addQuery
Add a query key and value to the URI.
changeQuery
Change a query part of the URI.
setFragment
Set the fragment part of the URI.