Pionia Core

API Documentation

Table of Contents

Namespaces

Pionia
Carbon

Enums

NAMESPACES
DIRECTORIES

Constants

BASEPATH  = $applicationPath
BASEPATH  = dirname(__DIR__, 2)
PIONIA_BINARY  = 'pionia'

Functions

allBuiltins()  : Arrayable
tap()  : HighOrderTapProxy|TValue
Call the given Closure with the given value then return the value.
arr()  : Arrayable
Get an item from an array using "dot" notation.
env()  : mixed
Get an item from the environment. Or default if it does not exist.
setEnv()  : void
Adds a temporary key-value to the environment.
response()  : BaseResponse
Helper function to return a response
app()  : PioniaApplication
Helper function to return the application instance
container()  : Container
Helper function to return the application container
db()  : Porm|null
Run any pionia-powered queries
table()  : Porm
Run any pionia-powered queries
alias()  : mixed
directoryFor()  : mixed
Get any directory from the application container
yesNo()  : string
This function returns a yes or no phrase based on the condition
asBool()  : array<string|int, mixed>
convert a value to a boolean
writeIniFile()  : bool
Write an ini configuration file This writes to the file in a lock-safe manner
logger()  : LoggerInterface
Get the logger instance from the application container
addIniSection()  : bool
This function adds a new section to an ini file We generally use this to generate and add new sections to the generated.ini file which holds settings for the auto-generated files
cachedResponse()  : BaseResponse
This function caches a response if the service has caching enabled.
recached()  : BaseResponse
Acronym for `cachedResponse` function but with more readable arguments
render()  : void
Render a template file from the templates folder.
parseHtml()  : array<string|int, mixed>
Get all the builtins
asset()  : string|null
Get the asset path
blank()  : bool
Determine if the given value is "blank".
validate()  : Validator
Validate data
toCamelCase()  : string
Convert a string to camel case
toSnakeCase()  : string
Convert a string to snake case
classify()  : string
Convert a string to a class name like format
arrayToString()  : string
Convert an array to a string
slugify()  : string
Convert a string to a slug-like format
singularize()  : string
Convert a string to a singular form
pluralize()  : string
Convert a string to a plural form
capitalize()  : string
Capitalize a string
jsonify()  : string
Convert anything to a json string
flatten()  : array<string|int, mixed>
Flatten an array
getMaxHistoryMonthsByAmount()  : int
getHtmlAttribute()  : string
getOpenCollectiveSponsors()  : string

Constants

BASEPATH

public mixed BASEPATH = dirname(__DIR__, 2)

Functions

tap()

Call the given Closure with the given value then return the value.

tap(TValue $value[, callable(TValue): mixed|null $callback = null ]) : HighOrderTapProxy|TValue

Value returned is not transformed by the closure.

Parameters
$value : TValue
$callback : callable(TValue): mixed|null = null
Tags
template

TValue

Return values
HighOrderTapProxy|TValue

arr()

Get an item from an array using "dot" notation.

arr(array<string|int, mixed>|null $array) : Arrayable
Parameters
$array : array<string|int, mixed>|null
Return values
Arrayable

env()

Get an item from the environment. Or default if it does not exist.

env([string|null $key = null ][, mixed $default = null ]) : mixed

If both the key and the default value are null, the function should return the entire environment.

Parameters
$key : string|null = null
$default : mixed = null

setEnv()

Adds a temporary key-value to the environment.

setEnv(string $key, mixed $value) : void

This can only be retrieved using the env function.

Parameters
$key : string
$value : mixed

response()

Helper function to return a response

response([ $returnCode = 0 ][, string|null $returnMessage = null ][, mixed $returnData = null ][, mixed $extraData = null ]) : BaseResponse
Parameters
$returnCode : = 0

int

$returnMessage : string|null = null
$returnData : mixed = null
$extraData : mixed = null
Return values
BaseResponse

container()

Helper function to return the application container

container() : Container
Return values
Container

db()

Run any pionia-powered queries

db(string $tableName[, string|null $tableAlias = null ][, string|null $using = null ]) : Porm|null
Parameters
$tableName : string

The name of the table to connect to

$tableAlias : string|null = null
$using : string|null = null
Tags
throws
Exception
Return values
Porm|null

table()

Run any pionia-powered queries

table(string $tableName[, string|null $tableAlias = null ][, string|null $using = null ]) : Porm
Parameters
$tableName : string

The name of the table to connect to

$tableAlias : string|null = null

The alias to use for the table provided

$using : string|null = null

The connection to use

Tags
throws
Exception
example
table('users')->where(['username' => 'Pionia'])->get();
Return values
Porm

The porm instance for further chaining of queries

alias()

alias(mixed $key) : mixed
Parameters
$key : mixed

directoryFor()

Get any directory from the application container

directoryFor(mixed $key) : mixed
Parameters
$key : mixed

yesNo()

This function returns a yes or no phrase based on the condition

yesNo(bool $condition[, string|null $yesPhrase = 'Yes' ][, string|null $noPhrase = 'No' ]) : string
Parameters
$condition : bool

The condition to check

$yesPhrase : string|null = 'Yes'

The phrase to return if the condition is true

$noPhrase : string|null = 'No'

The phrase to return if the condition is false

Return values
string

asBool()

convert a value to a boolean

asBool(mixed $value) : array<string|int, mixed>
Parameters
$value : mixed
Return values
array<string|int, mixed>

writeIniFile()

Write an ini configuration file This writes to the file in a lock-safe manner

writeIniFile(string $file[, array<string|int, mixed> $array = [] ]) : bool
Parameters
$file : string
$array : array<string|int, mixed> = []
Return values
bool

logger()

Get the logger instance from the application container

logger() : LoggerInterface
Return values
LoggerInterface

addIniSection()

This function adds a new section to an ini file We generally use this to generate and add new sections to the generated.ini file which holds settings for the auto-generated files

addIniSection(string $section[, array<string|int, mixed>|null $keyValueToAppend = [] ][, string $iniFile = 'generated.ini' ]) : bool

This function will create the file if it does not exist, add the section if it does not exist or update the section if it exists

Parameters
$section : string
$keyValueToAppend : array<string|int, mixed>|null = []
$iniFile : string = 'generated.ini'
Return values
bool

cachedResponse()

This function caches a response if the service has caching enabled.

cachedResponse(Service $instance, BaseResponse $response[, mixed $ttl = 60 ]) : BaseResponse

Cached key is of the format service_action in camel case. If no ttl is defined, caching will happen for only 60 seconds

Parameters
$instance : Service

The service we are currently in, just pass this here!

$response : BaseResponse

The response object to cache, you can use response() for this!

$ttl : mixed = 60

The time to live for the cache, defaults to 60 seconds

Tags
note

This function is only available if the service has caching enabled

note

This is still under rigorous tests

Return values
BaseResponse

The cached response / the response you passed. It's not tampered with

recached()

Acronym for `cachedResponse` function but with more readable arguments

recached(Service $instance, mixed ...$args) : BaseResponse
Parameters
$instance : Service

The service we are currently in, just pass this here

$args : mixed

The arguments to pass to the cachedResponse function

Tags
note

This function is only useful if the service has caching enabled

Return values
BaseResponse

render()

Render a template file from the templates folder.

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

parseHtml()

Get all the builtins

parseHtml( $file[, array<string|int, mixed>|null $data = [] ]) : array<string|int, mixed>
Parameters
$file :
$data : array<string|int, mixed>|null = []
Return values
array<string|int, mixed>

asset()

Get the asset path

asset( $file[, string|null $dir = null ]) : string|null
Parameters
$file :
$dir : string|null = null
Return values
string|null

blank()

Determine if the given value is "blank".

blank(mixed $value) : bool
Parameters
$value : mixed
Tags
phpstan-assert-if-false

!=null|'' $value

phpstan-assert-if-true

!=numeric|bool $value

Return values
bool

validate()

Validate data

validate(string $field, Arrayable|Request|Service $data) : Validator
Parameters
$field : string
$data : Arrayable|Request|Service
Return values
Validator

toCamelCase()

Convert a string to camel case

toCamelCase(string $value) : string
Parameters
$value : string
Return values
string

toSnakeCase()

Convert a string to snake case

toSnakeCase(string $value) : string
Parameters
$value : string
Return values
string

classify()

Convert a string to a class name like format

classify(string $value) : string
Parameters
$value : string
Return values
string

arrayToString()

Convert an array to a string

arrayToString(array<string|int, mixed> $value[, string|null $separator = ',' ]) : string
Parameters
$value : array<string|int, mixed>
$separator : string|null = ','
Return values
string

slugify()

Convert a string to a slug-like format

slugify(string $value) : string
Parameters
$value : string
Return values
string

singularize()

Convert a string to a singular form

singularize(string $word) : string
Parameters
$word : string
Return values
string

pluralize()

Convert a string to a plural form

pluralize(string $word) : string
Parameters
$word : string
Return values
string

capitalize()

Capitalize a string

capitalize(string $phrase) : string
Parameters
$phrase : string
Return values
string

jsonify()

Convert anything to a json string

jsonify(mixed $phrase) : string
Parameters
$phrase : mixed
Return values
string

flatten()

Flatten an array

flatten(array<string|int, mixed> $flatten) : array<string|int, mixed>
Parameters
$flatten : array<string|int, mixed>
Tags
example

flatten(['a', 'b', ['c', 'd']]) => ['a', 'b', 'c', 'd']

Return values
array<string|int, mixed>

getMaxHistoryMonthsByAmount()

getMaxHistoryMonthsByAmount(mixed $amount) : int
Parameters
$amount : mixed
Return values
int

getHtmlAttribute()

getHtmlAttribute(mixed $rawValue) : string
Parameters
$rawValue : mixed
Return values
string

getOpenCollectiveSponsors()

getOpenCollectiveSponsors() : string
Return values
string

        
On this page

Search results