Source Code Docs

StaticPageBuilder
in package

Compile a Laravel route into static HTML

Tags
author

Caen De Silva

todo

add option to change source and output directories (PRs welcome!)

Table of Contents

$pageCollection  : Collection
The Collection of Pages to compile.
__construct()  : mixed
Construct the Builder.
buildPage()  : void
Compile the page and store it to file.
copyAssets()  : int
Copy all the media files from the sourcePath/media directory to the buildPath/media directory.
curlBuilder()  : string
Get the HTML using Curl. (Recommended)
ensureDirectoryExists()  : void
Check if the build directories exists, otherwise create them.
getContentsBuilder()  : string
Get HTML using file_get_contents (Not Recommended)
getPageCollection()  : Collection
Get the Collection of pages using the MarkdownPageCollection interface.
mergeStylesheets()  : void
Merge the app.css and custom.css
startBuildLoop()  : int
Start the Build Loop.

Properties

Methods

__construct()

Construct the Builder.

public __construct() : mixed
Tags
throws
Exception

if an invalid builder is specified

Return values
mixed

buildPage()

Compile the page and store it to file.

private buildPage(string $slug[, string $builder = 'curl' ]) : void
Parameters
$slug : string

of the page to compile

$builder : string = 'curl'

which builder should be used?

Tags
see
self::startBuildLoop
throws
Exception

if an invalid builder is specified

Return values
void

copyAssets()

Copy all the media files from the sourcePath/media directory to the buildPath/media directory.

private copyAssets() : int
Return values
int

$count of files copied

curlBuilder()

Get the HTML using Curl. (Recommended)

private curlBuilder(string $url) : string
Parameters
$url : string
Return values
string

$html

ensureDirectoryExists()

Check if the build directories exists, otherwise create them.

private ensureDirectoryExists() : void
Return values
void

getContentsBuilder()

Get HTML using file_get_contents (Not Recommended)

private getContentsBuilder(string $url) : string

Has issue with JavaScript needed to render the sidebar, and is thus not recommended for use. Use Curl instead.

Parameters
$url : string
Return values
string

$html

getPageCollection()

Get the Collection of pages using the MarkdownPageCollection interface.

private getPageCollection() : Collection
Tags
uses
MarkdownPageCollection
Return values
Collection

$pageCollection

mergeStylesheets()

Merge the app.css and custom.css

private mergeStylesheets() : void
Return values
void

startBuildLoop()

Start the Build Loop.

private startBuildLoop() : int

The loop which iterates through all the pages in the pageCollection and subsequently builds the pages.

Tags
uses
self::buildPage
throws
Exception

if an invalid builder is specified

Return values
int

$count of files built

Search results