WebDAV
WebDAV
WebDAV client for interacting with WebDAV servers.
class WebDAV extends \Hazaar\HTTP\ClientProvides methods for authentication, file and directory operations, property management, and protocol compliance. Handles connection setup, allowed methods, and protocol class negotiation.
Properties
url
The base URL for the WebDAV server.
private URL $urlauthorised
Indicates whether the client is authorised with the WebDAV server.
private bool $authorisedsettings
private array $settingsclasses
private array $classesallow
private array $allowMethods
__construct
public __construct(array $settings): voidParameters
| Parameter | Type | Description |
|---|---|---|
$settings | array |
isAuthorised
Checks if the client is authorised with the WebDAV server.
public isAuthorised(): boolgetAbsoluteUrl
Returns an absolute URL by appending the given URI to the base WebDAV URL.
public getAbsoluteUrl(string $uri): URLParameters
| Parameter | Type | Description |
|---|---|---|
$uri | string | the URI to append to the base URL |
path
Returns the relative path for a given URI based on the base WebDAV URL.
public path(string $uri): stringIf the URI is absolute, extracts the path. Computes the relative path with respect to the base URL.
Parameters
| Parameter | Type | Description |
|---|---|---|
$uri | string | the URI to resolve |
options
Sends an HTTP OPTIONS request to the specified URL via WebDAV.
public options(string $url): ResponseParameters
| Parameter | Type | Description |
|---|---|---|
$url | string | the URL to send the OPTIONS request to |
propfind
Get the contents of a file.
public propfind(string $url, array $properties, int $depth = 1, bool $returnResponse, array $namespaces): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$url | string | the URL of the file to get the contents of |
$properties | array | An array of properties to request. If empty, all properties will be requested. |
$depth | int | the depth of the PROPFIND request |
$returnResponse | bool | if true, the raw response object will be returned instead of the file contents |
$namespaces | array | an array of namespaces to use in the PROPFIND request |
proppatch
public proppatch(string $url, array $properties): boolParameters
| Parameter | Type | Description |
|---|---|---|
$url | string | |
$properties | array | An array of properties to request. If empty, all properties will be requested. |
mkcol
Create a collection object (ie: a directory/folder).
public mkcol(string $url): boolParameters
| Parameter | Type | Description |
|---|---|---|
$url | string |
put
Create a new object (ie: a file);.
public put(string $url, ?string $content, ?string $datatype): boolParameters
| Parameter | Type | Description |
|---|---|---|
$url | string | |
$content | string | |
$datatype | string |
putFile
Uploads a file to the specified directory URL using WebDAV PUT.
public putFile(string $dirUrl, File $file): boolParameters
| Parameter | Type | Description |
|---|---|---|
$dirUrl | string | the directory URL to upload the file to |
$file | File | the file object to upload |
delete
Sends an HTTP DELETE request to the specified URL via WebDAV.
public delete(URL $url): ResponseParameters
| Parameter | Type | Description |
|---|---|---|
$url | URL | the URL to send the DELETE request to |
xml
Outputs the provided XML element as an HTTP response and terminates execution.
public xml(Element $xml): voidParameters
| Parameter | Type | Description |
|---|---|---|
$xml | Element | the XML element to output |
parseProperties
protected parseProperties(Element $dom): voidParameters
| Parameter | Type | Description |
|---|---|---|
$dom | Element |
parseMultiStatus
protected parseMultiStatus(string $xml): voidParameters
| Parameter | Type | Description |
|---|---|---|
$xml | string |
isMethodAllowed
Checks if the specified HTTP method is allowed by the WebDAV server.
private isMethodAllowed(string $method): boolParameters
| Parameter | Type | Description |
|---|---|---|
$method | string | The HTTP method to check (e.g., 'GET', 'PUT', 'DELETE'). |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000