Leaf PHP

Documentation

Table of Contents

Namespaces

Leaf

Functions

asQuestion()  : mixed
Apply CLI question styles to text
asComment()  : mixed
Apply CLI comment styles to text
asInfo()  : mixed
Apply CLI info styles to text
asError()  : mixed
Apply CLI error styles to text
asLink()  : mixed
Output text as a link
auth()  : Auth
Return the leaf auth object
getDatabaseConnection()  : array<string|int, mixed>
dbInstance()  : Db
authInstance()  : Auth
deleteUser()  : mixed
createTableForUsers()  : void
csrf()  : CSRF
Return the leaf csrf object
tick()  : Date
Return the leaf date instance
db()  : Db
Return the database object
fetch()  : mixed
Shortcut method for making network requests.
form()  : Form
Return leaf form object
validator()  : mixed
path()  : Path
Return the Leaf instance
storage()  : Storage
Return the Leaf instance
request()  : Request
Return request or request data
response()  : Response
Return response or set response data
inertia()  : mixed
Render Inertia page
app()  : App
Return the Leaf instance
_env()  : mixed
Gets the value of an environment variable.
mailer()  : Mail
Create and send an email
AppConfig()  : mixed
Get app configuration
PathsConfig()  : mixed
Get paths configuration
AuthConfig()  : mixed
Get an auth configuration
ViewConfig()  : mixed
Get view configuration
DatabaseConfig()  : mixed
Get database configuration
CorsConfig()  : mixed
Get an auth configuration
MailConfig()  : mixed
Get mail configuration
MvcConfig()  : mixed
Get an application configuration
assets()  : mixed
Import an asset
view()  : string
Return a view
render()  : mixed
Render a view
redirect()  : mixed
Redirect to a given url
route()  : mixed
Get a route by name
vite()  : mixed
Get a route by name
AppPaths()  : mixed
Get all app paths
ConfigPath()  : string
Config directory path
CommandsPath()  : string
Commands directory path
ControllersPath()  : string
Controllers directory path
DatabasePath()  : string
Database path
FactoriesPath()  : string
Factories directory path
HelpersPath()  : string
Helpers directory path
LibPath()  : string
Helpers directory path
MigrationsPath()  : string
Migrations directory path
ModelsPath()  : string
Models directory path
PublicPath()  : string
Public directory path
RoutesPath()  : string
Routes directory path
SeedsPath()  : string
Seeds directory path
StoragePath()  : string
Storage directory path
ViewsPath()  : string
Views directory path
queue()  : Queue
Return queue object
dispatch()  : mixed
Dispatch a job, batch or a group of jobs
redis()  : Redis
Return redis object
session()  : Session
Return session object
flash()  : Flash
Return flash data/object or set flash data
vite()  : mixed
Get a route by name

Functions

asQuestion()

Apply CLI question styles to text

asQuestion(mixed $data) : mixed
Parameters
$data : mixed

asComment()

Apply CLI comment styles to text

asComment(mixed $data) : mixed
Parameters
$data : mixed

asInfo()

Apply CLI info styles to text

asInfo(mixed $data) : mixed
Parameters
$data : mixed

asError()

Apply CLI error styles to text

asError(mixed $data) : mixed
Parameters
$data : mixed

Output text as a link

asLink(mixed $link, mixed $display) : mixed
Parameters
$link : mixed
$display : mixed

tick()

Return the leaf date instance

tick([string|null $userDate = null ][, string|null $userTimeZone = null ]) : Date
Parameters
$userDate : string|null = null
$userTimeZone : string|null = null
Return values
Date

db()

Return the database object

db([string|null $connection = null ]) : Db
Parameters
$connection : string|null = null

The connection to return db with

Return values
Db

fetch()

Shortcut method for making network requests.

fetch([array<string|int, mixed>|string $data = null ]) : mixed
Parameters
$data : array<string|int, mixed>|string = null

The url or request to hit.

Tags
throws
Exception

validator()

validator() : mixed

path()

Return the Leaf instance

path(string $path) : Path
Parameters
$path : string
Return values
Path

inertia()

Render Inertia page

inertia(string $component[, array<string|int, mixed> $props = [] ]) : mixed
Parameters
$component : string

The component to render.

$props : array<string|int, mixed> = []

The props to pass to the component.

_env()

Gets the value of an environment variable.

_env(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

mailer()

Create and send an email

mailer([array<string|int, mixed> $mail = null ]) : Mail

Note that \Leaf\Mail\Mailer should be configured

Parameters
$mail : array<string|int, mixed> = null
Return values
Mail

AppConfig()

Get app configuration

AppConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

PathsConfig()

Get paths configuration

PathsConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

AuthConfig()

Get an auth configuration

AuthConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

ViewConfig()

Get view configuration

ViewConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

DatabaseConfig()

Get database configuration

DatabaseConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

CorsConfig()

Get an auth configuration

CorsConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

MailConfig()

Get mail configuration

MailConfig([mixed $setting = null ]) : mixed
Parameters
$setting : mixed = null

MvcConfig()

Get an application configuration

MvcConfig(mixed $appConfig[, mixed $setting = null ]) : mixed
Parameters
$appConfig : mixed
$setting : mixed = null

assets()

Import an asset

assets([string $assets = '' ]) : mixed
Parameters
$assets : string = ''

The asset to import

view()

Return a view

view(string $view[, array<string|int, mixed>|object $data = [] ]) : string
Parameters
$view : string

The view to render

$data : array<string|int, mixed>|object = []

The data to pass to the view

Return values
string

render()

Render a view

render(string $view[, array<string|int, mixed>|object $data = [] ]) : mixed
Parameters
$view : string

The view to render

$data : array<string|int, mixed>|object = []

The data to pass to the view

redirect()

Redirect to a given url

redirect(string $url) : mixed
Parameters
$url : string

The url to redirect to

vite()

Get a route by name

vite(mixed $files[, string $baseDir = 'app/views' ]) : mixed
Parameters
$files : mixed
$baseDir : string = 'app/views'

The base directory to look for the file(s)

AppPaths()

Get all app paths

AppPaths([mixed $path = null ][, bool $slash = false ]) : mixed
Parameters
$path : mixed = null
$slash : bool = false

ConfigPath()

Config directory path

ConfigPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

CommandsPath()

Commands directory path

CommandsPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

ControllersPath()

Controllers directory path

ControllersPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

DatabasePath()

Database path

DatabasePath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

FactoriesPath()

Factories directory path

FactoriesPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

HelpersPath()

Helpers directory path

HelpersPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

LibPath()

Helpers directory path

LibPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

MigrationsPath()

Migrations directory path

MigrationsPath([mixed $path = '' ][, bool $slash = true ]) : string
Parameters
$path : mixed = ''
$slash : bool = true
Return values
string

ModelsPath()

Models directory path

ModelsPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

PublicPath()

Public directory path

PublicPath([mixed $path = '' ][, mixed $slash = true ]) : string
Parameters
$path : mixed = ''
$slash : mixed = true
Return values
string

RoutesPath()

Routes directory path

RoutesPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

SeedsPath()

Seeds directory path

SeedsPath([mixed $path = '' ]) : string
Parameters
$path : mixed = ''
Return values
string

StoragePath()

Storage directory path

StoragePath([mixed $path = '' ][, bool $slash = false ]) : string
Parameters
$path : mixed = ''
$slash : bool = false
Return values
string

ViewsPath()

Views directory path

ViewsPath([mixed $path = '' ][, bool $slash = true ]) : string
Parameters
$path : mixed = ''
$slash : bool = true
Return values
string

dispatch()

Dispatch a job, batch or a group of jobs

dispatch(array<string|int, mixed>|Dispatchable|string $dispatchable) : mixed
Parameters
$dispatchable : array<string|int, mixed>|Dispatchable|string

The job, batch or group of jobs to dispatch

vite()

Get a route by name

vite(mixed $files[, string|null $baseDir = null ]) : mixed
Parameters
$files : mixed
$baseDir : string|null = null

The base directory to look for the file(s)

Search results