Includes
in package
uses
InteractsWithDirectories
The Includes facade provides a simple way to access partials in the includes directory.
Both Markdown and Blade includes will be rendered to HTML.
Table of Contents
Properties
- $includesDirectory : string
Methods
- blade() : string|null
- Get the rendered Blade of a partial file in the includes directory.
- get() : string|null
- Get the raw contents of a partial file in the includes directory.
- html() : string|null
- Get the HTML contents of a partial file in the includes directory.
- markdown() : string|null
- Get the rendered Markdown of a partial file in the includes directory.
- path() : string
- Return the path to the includes directory, or a partial within it, if requested.
- needsDirectories() : void
- Ensure the supplied directories exist by creating them if they don't.
- needsDirectory() : void
- Ensure the supplied directory exist by creating it if it does not.
- needsParentDirectory() : void
- Ensure the supplied file's parent directory exists by creating it if it does not.
Properties
$includesDirectory
protected
static string
$includesDirectory
= 'resources/includes'
The directory where includes are stored.
Methods
blade()
Get the rendered Blade of a partial file in the includes directory.
public
static blade(string $filename[, string|null $default = null ]) : string|null
Parameters
- $filename : string
-
The name of the partial file, with or without the extension.
- $default : string|null = null
-
The default value to return if the partial is not found.
Return values
string|null —The rendered contents of the partial file, or the default value if not found.
get()
Get the raw contents of a partial file in the includes directory.
public
static get(string $filename[, string|null $default = null ]) : string|null
Parameters
- $filename : string
-
The name of the partial file, including the extension.
- $default : string|null = null
-
The default value to return if the partial is not found.
Return values
string|null —The contents of the partial file, or the default value if not found.
html()
Get the HTML contents of a partial file in the includes directory.
public
static html(string $filename[, string|null $default = null ]) : string|null
Parameters
- $filename : string
-
The name of the partial file, with or without the extension.
- $default : string|null = null
-
The default value to return if the partial is not found.
Return values
string|null —The raw contents of the partial file, or the default value if not found.
markdown()
Get the rendered Markdown of a partial file in the includes directory.
public
static markdown(string $filename[, string|null $default = null ]) : string|null
Parameters
- $filename : string
-
The name of the partial file, with or without the extension.
- $default : string|null = null
-
The default value to return if the partial is not found.
Return values
string|null —The rendered contents of the partial file, or the default value if not found.
path()
Return the path to the includes directory, or a partial within it, if requested.
public
static path([string|null $filename = null ]) : string
Parameters
- $filename : string|null = null
-
The partial to return, or null to return the directory.
Return values
string —Absolute Hyde::path() to the partial, or the includes directory.
needsDirectories()
Ensure the supplied directories exist by creating them if they don't.
protected
static needsDirectories(array<string|int, string> $directories) : void
Parameters
- $directories : array<string|int, string>
-
array with relative file paths to the directories
needsDirectory()
Ensure the supplied directory exist by creating it if it does not.
protected
static needsDirectory(string $directory) : void
Parameters
- $directory : string
-
relative file path to the directory
needsParentDirectory()
Ensure the supplied file's parent directory exists by creating it if it does not.
protected
static needsParentDirectory(string $file[, int $levels = 1 ]) : void
Parameters
- $file : string
- $levels : int = 1